Details
-
Bug
-
Resolution: Fixed
-
P3
-
22, 23, 24
-
b07
-
generic
-
generic
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8337384 | 23.0.2 | Jan Lahoda | P3 | Resolved | Fixed | master |
JDK-8337927 | 23.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b06 |
JDK-8336705 | 23 | Jan Lahoda | P3 | Resolved | Fixed | b33 |
Description
ADDITIONAL SYSTEM INFORMATION :
Linux
Later release jdk-22.0.1
and
Latest Early Access
openjdk version "24-ea" 2025-03-18
OpenJDK Runtime Environment (build 24-ea+4-379)
OpenJDK 64-Bit Server VM (build 24-ea+4-379, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Using "javac" to compile Main.java (or running the source file with "java") causes AssertionError
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Main.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The source file should be compiled to a class file
ACTUAL -
An exception has occurred in the compiler (24-ea). 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.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.checkNull(Assert.java:54)
at jdk.compiler/com.sun.tools.javac.jvm.Code.addLocalVar(Code.java:2007)
at jdk.compiler/com.sun.tools.javac.jvm.Code.newLocal(Code.java:2223)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1068)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1063)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitLetExpr(Gen.java:2451)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$LetExpr.accept(JCTree.java:3408)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:884)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1934)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1857)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1063)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1063)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.internalVisitBlock(Gen.java:1121)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1085)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1133)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.internalVisitBlock(Gen.java:1121)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlockWithPatterns(Gen.java:1097)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1083)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1133)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:949)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:912)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:957)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2494)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:770)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1702)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1670)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:977)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
printing javac parameters to: /tmp/javac.20240704_142653.args
---------- BEGIN SOURCE ----------
class Main {
record A(String s) {}
public static void main(String[] args) {
java.util.List.of(new A("A")).forEach(a -> check(a instanceof
A(String s)));
}
static void check(boolean a) {}
}
---------- END SOURCE ----------
FREQUENCY : always
Linux
Later release jdk-22.0.1
and
Latest Early Access
openjdk version "24-ea" 2025-03-18
OpenJDK Runtime Environment (build 24-ea+4-379)
OpenJDK 64-Bit Server VM (build 24-ea+4-379, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Using "javac" to compile Main.java (or running the source file with "java") causes AssertionError
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Main.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The source file should be compiled to a class file
ACTUAL -
An exception has occurred in the compiler (24-ea). 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.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.checkNull(Assert.java:54)
at jdk.compiler/com.sun.tools.javac.jvm.Code.addLocalVar(Code.java:2007)
at jdk.compiler/com.sun.tools.javac.jvm.Code.newLocal(Code.java:2223)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1068)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1063)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitLetExpr(Gen.java:2451)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$LetExpr.accept(JCTree.java:3408)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:884)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1934)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1857)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1063)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1063)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.internalVisitBlock(Gen.java:1121)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1085)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1133)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.internalVisitBlock(Gen.java:1121)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlockWithPatterns(Gen.java:1097)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1083)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1133)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:949)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:912)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:957)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2494)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:770)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1702)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1670)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:977)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
printing javac parameters to: /tmp/javac.20240704_142653.args
---------- BEGIN SOURCE ----------
class Main {
record A(String s) {}
public static void main(String[] args) {
java.util.List.of(new A("A")).forEach(a -> check(a instanceof
A(String s)));
}
static void check(boolean a) {}
}
---------- END SOURCE ----------
FREQUENCY : always
Attachments
Issue Links
- backported by
-
JDK-8336705 javac AssertionError addLocalVar checkNull
- Resolved
-
JDK-8337384 javac AssertionError addLocalVar checkNull
- Resolved
-
JDK-8337927 javac AssertionError addLocalVar checkNull
- Resolved
- links to
-
Commit(jdk23) openjdk/jdk/e83e2b30
-
Commit(master) openjdk/jdk/2b0adfc2
-
Review(jdk23) openjdk/jdk/20183
-
Review(master) openjdk/jdk/20110
(2 links to)