Java 反射的构造函数未正确运行
我使用Java 反射的构造函数未正确运行,java,reflections,Java,Reflections,我使用Reflectionslibrary()获取包中的所有类。我只是使用以下代码: public static void build() { System.out.println("Start reflection"); Reflections reflections = new Reflections("org.octocash.client.support.cache"); System.out.println("Done with constructor")
Reflections
library()获取包中的所有类。我只是使用以下代码:
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);
}
publicstaticvoidbuild(){
System.out.println(“开始反射”);
反射=新反射(“org.octocash.client.support.cache”);
System.out.println(“与构造函数一起完成”);
set1应该发生以下四种情况之一:抛出异常,创建反射需要很长时间,但最终到达下一行,应用程序崩溃,然后您应该得到一些stackdump,或者在构造函数调用的某个地方,比如System.exit()
执行,应用程序终止。感谢您的评论!我现在尝试通过引用JAR而不是uberjar来告诉我们这一点,现在它似乎可以工作了。