-
Bug
-
Resolution: Fixed
-
P3
-
21, 23
-
b24
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
I have an annotation processor that generates records. Occasionally, it generates an NPE as follows
java: An exception has occurred in the compiler (21.0.2). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://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: java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Symbol$MethodSymbol.flags()" because "rc.accessor" is null
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.lambda$generateMandatedAccessors$5(Lower.java:2390)
java: at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
java: at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
java: at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
java: at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
java: at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
java: at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
java: at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
java: at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.generateMandatedAccessors(Lower.java:2397)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.visitRecordDef(Lower.java:2594)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2289)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:814)
java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.translate(Lower.java:2181)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.translate(Lower.java:2200)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:4293)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1654)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1468)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:976)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:239)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.lambda$compileJava$2(JavaBuilder.java:521)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:583)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:519)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:363)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:288)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:242)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1569)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1198)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1349)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1163)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:931)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:487)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:198)
java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:134)
java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:387)
java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:212)
java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:211)
java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java: at java.base/java.lang.Thread.run(Thread.java:1583)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
FREQUENCY : often
I have an annotation processor that generates records. Occasionally, it generates an NPE as follows
java: An exception has occurred in the compiler (21.0.2). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://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: java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Symbol$MethodSymbol.flags()" because "rc.accessor" is null
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.lambda$generateMandatedAccessors$5(Lower.java:2390)
java: at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
java: at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
java: at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
java: at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
java: at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
java: at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
java: at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
java: at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.generateMandatedAccessors(Lower.java:2397)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.visitRecordDef(Lower.java:2594)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2289)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:814)
java: at jdk.compiler/com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.translate(Lower.java:2181)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.translate(Lower.java:2200)
java: at jdk.compiler/com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:4293)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1654)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1468)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:976)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:239)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.lambda$compileJava$2(JavaBuilder.java:521)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:583)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:519)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:363)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:288)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:242)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1569)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1198)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1349)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1163)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:931)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:487)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:198)
java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:134)
java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:387)
java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:212)
java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:211)
java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java: at java.base/java.lang.Thread.run(Thread.java:1583)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
FREQUENCY : often