mardi 4 décembre 2018

java.lang.NoSuchMethodError with Reflections

Im getting this error and I'm really not sure why, it was working fine for the few days I was using it, then today when I went to use it (changed nothing) it just stopped working...?

java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;
    at org.reflections.Reflections.expandSuperTypes(Reflections.java:380) ~[?:?]
    at org.reflections.Reflections.<init>(Reflections.java:126) ~[?:?]
    at org.reflections.Reflections.<init>(Reflections.java:168) ~[?:?]
    at org.reflections.Reflections.<init>(Reflections.java:141) ~[?:?]
    at me.realm.commons.reflection.Reflect.getClassesExtending(Reflect.java:14) ~[?:?]

My maven dependency (and I've included it in the project build path)

    <dependency>
        <groupId>org.reflections</groupId>
        <artifactId>reflections</artifactId>
        <version>0.9.11</version>
    </dependency>

My code that throws the error:

public static <T> Set<Class<? extends T>> getClassesExtending(Class<T> clazz) {
    Reflections reflections = new Reflections(""); //<-- this line
    Set<Class<? extends T>> classes = reflections.getSubTypesOf(clazz);

    if (classes.size() <= 0) {
        Logger.warn("No classes extending " + clazz.getCanonicalName());
        return classes;
    }

    return classes;
}





Aucun commentaire:

Enregistrer un commentaire