Regression after jpackage+1-49 update
Tornai András
tornaiandrasede at gmail.com
Sun Oct 6 15:21:47 UTC 2019
Hello,
After I updated my project from jpackage+1-35 to the latest jpackage+1-49 I
noticed that Java now throws NoClassDefFoundError while this was not the
case before.
Repro case:
import java.lang.reflect.Field;
import java.util.Optional;
public class Main {
private Optional<Service> service;
public static void main(String[] args) throws Exception {
System.out.println(Runtime.version());
Class<?> class0 = Main.class.getClassLoader().loadClass("Main");
Field field0 = class0.getDeclaredField("service");
field0.getGenericType();
}
}
public class Service {
public Service(OptionalService optionalService) {
}
public Service() {
this(new OptionalService() {
});
}
}
public class OptionalService {
}
*With 14-jpackage+1-35*
c:\Private\jdk14-jpackage-1-35-vs-49>javac Main.java
c:\Private\jdk14-jpackage-1-35-vs-49>del OptionalService.class
c:\Private\jdk14-jpackage-1-35-vs-49>java Main
14-jpackage+1-35
*With 14-jpackage+1-49*
c:\Private\jdk14-jpackage-1-35-vs-49>javac Main.java
c:\Private\jdk14-jpackage-1-35-vs-49>del OptionalService.class
c:\Private\jdk14-jpackage-1-35-vs-49>java Main
14-jpackage+1-49
Exception in thread "main" java.lang.NoClassDefFoundError: OptionalService
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:420)
at
java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at
java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at
java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at
java.base/sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at
java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at
java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at
java.base/sun.reflect.generics.repository.FieldRepository.computeGenericType(FieldRepository.java:90)
at
java.base/sun.reflect.generics.repository.FieldRepository.getGenericType(FieldRepository.java:82)
at java.base/java.lang.reflect.Field.getGenericType(Field.java:266)
at Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: OptionalService
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 12 more
Regards,
András
More information about the core-libs-dev
mailing list