0

I am using the Reflections library (see info) to get all classes within a package. I am just using the following code:

public static void build() {

    System.out.println("Start reflection");

    Reflections reflections = new Reflections("org.octocash.client.support.cache");

    System.out.println("Done with constructor");

    Set<Class<?>> dataClasses = reflections.getSubTypesOf(Object.class)
                                .stream().filter(c -> !c.getClass().equals(Data.class))
                                .collect(Collectors.toSet());

    data.addAll(dataClasses);

}

The problem is that it only prints "Start reflection" in the console, so it is unable to run the constructor. If I surround the code with a try-catch block, it is not printing an Exception either.

I am using the uberjar from Reflections (not using Maven), so maybe it has something to do with this.

What could be happening here? I am totally in the dark on how to debug this..

Any help is greatly appreciated!

bashoogzaad
  • 4,611
  • 8
  • 40
  • 65
  • One of four things should happen: Exception is thrown, creation of the reflection takes a long time but eventually reaches the next line, the application crashes, then you should get some stackdump, or somewhere in the call of the constructor something like `System.exit()` is executed and the application terminates. – hotzst Oct 10 '15 at 09:36
  • Thanks for your comment! I now tried to us this https://code.google.com/p/reflections/wiki/ClasspathNotes, by referencing the jars, instead of the uberjar, and now it seems to work. – bashoogzaad Oct 10 '15 at 09:48

0 Answers0