You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@UtilityClass together with a generic method and two methods of the same name causes Javac to crash with NPE in Java 11, 17, 18 and 19 but not 8 (not tested others).
There are a lot of small changes that make the code compile:
static is added to the inner class DTO;
one of the convert methods is renamed;
convertValue(DTO.class) is replaced with just null;
the parameter of convertValue method is removed.
changing Class<T> to Class.
I have seen a few NPE reports but all were connected with val, while this is not.
An exception has occurred in the compiler (11.0.16.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.code.Types.asSuper(Types.java:2111)
at jdk.compiler/com.sun.tools.javac.code.Types$4.visitClassType(Types.java:1179)
at jdk.compiler/com.sun.tools.javac.code.Types$4.visitClassType(Types.java:1100)
at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:993)
at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4857)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtype(Types.java:1096)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtypeNoCapture(Types.java:1070)
at jdk.compiler/com.sun.tools.javac.code.Types$4.visitClassType(Types.java:1186)
at jdk.compiler/com.sun.tools.javac.code.Types$4.visitClassType(Types.java:1100)
at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:993)
at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4857)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtype(Types.java:1096)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtypeUncheckedInternal(Types.java:1022)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtypeUnchecked(Types.java:1008)
at jdk.compiler/com.sun.tools.javac.comp.Infer$IncorporationBinaryOpKind$1.apply(Infer.java:1183)
at jdk.compiler/com.sun.tools.javac.comp.Infer$IncorporationBinaryOp.apply(Infer.java:1238)
at jdk.compiler/com.sun.tools.javac.comp.Infer.doIncorporationOp(Infer.java:1169)
at jdk.compiler/com.sun.tools.javac.comp.Infer$IncorporationAction.isSubtype(Infer.java:721)
at jdk.compiler/com.sun.tools.javac.comp.Infer$CheckBounds.checkBound(Infer.java:796)
at jdk.compiler/com.sun.tools.javac.comp.Infer$CheckBounds.apply(Infer.java:772)
at jdk.compiler/com.sun.tools.javac.comp.Infer.doIncorporation(Infer.java:1115)
at jdk.compiler/com.sun.tools.javac.comp.Infer$GraphSolver.solve(Infer.java:1655)
at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.solve(InferenceContext.java:475)
at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.solve(InferenceContext.java:482)
at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:218)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:605)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:644)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4122)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3915)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3820)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:3805)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3555)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2264)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2006)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1650)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1866)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1562)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:743)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1294)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1036)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1098)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4685)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4576)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4505)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4450)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1337)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
Stacktrace in Java 17 looks very similar (frames are a few lines off) but we get more information:
An exception has occurred in the compiler (17.0.4.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException: Cannot read field "type" because "sym" is null
Version info:
Lombok version org.projectlombok:lombok:1.18.24 (used in Gradle)
Platform: Javas were installed using SDKMAN!
works:
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Temurin)(build 25.345-b01, mixed mode)
fails:
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)
also fails:
openjdk version "17.0.4.1" 2022-08-12
OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode, sharing)
The text was updated successfully, but these errors were encountered:
Rawi01
added a commit
to Rawi01/lombok
that referenced
this issue
Jan 9, 2023
Describe the bug
@UtilityClass
together with a generic method and two methods of the same name causes Javac to crash with NPE in Java 11, 17, 18 and 19 but not 8 (not tested others).There are a lot of small changes that make the code compile:
static
is added to the inner classDTO
;convert
methods is renamed;convertValue(DTO.class)
is replaced with justnull
;convertValue
method is removed.Class<T>
toClass
.I have seen a few NPE reports but all were connected with
val
, while this is not.To Reproduce
The full stack trace is:
Stacktrace in Java 17 looks very similar (frames are a few lines off) but we get more information:
Version info:
org.projectlombok:lombok:1.18.24
(used in Gradle)works:
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Temurin)(build 25.345-b01, mixed mode)
fails:
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)
also fails:
openjdk version "17.0.4.1" 2022-08-12
OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode, sharing)
The text was updated successfully, but these errors were encountered: