-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P3
-
None
-
Affects Version/s: 9, 26
-
Component/s: tools
A DESCRIPTION OF THE PROBLEM :
Attached code fails to compile on 11, 17, 21, 25 JDKs.
On 8 it does compile something, but prints warning. I dont know if resulted bytecode compiled with JDK 8 is valid.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Main.java
ACTUAL -
An exception has occurred in the compiler (25.0.1). 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.checkNonNull(Assert.java:62)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.fromAnnotations(Annotate.java:167)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateTypeSecondStage$0(Annotate.java:1069)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:198)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:322)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:703)
at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1472)
at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:1388)
at jdk.compiler/com.sun.tools.javac.comp.Check.importAccessible(Check.java:4480)
at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.lambda$resolveImports$1(TypeEnter.java:366)
at jdk.compiler/com.sun.tools.javac.code.Scope$FilterImportScope.lambda$getSymbolsByName$1(Scope.java:973)
at jdk.compiler/com.sun.tools.javac.util.Iterators$1.update(Iterators.java:100)
at jdk.compiler/com.sun.tools.javac.util.Iterators$1.<init>(Iterators.java:96)
at jdk.compiler/com.sun.tools.javac.util.Iterators.createFilterIterator(Iterators.java:95)
at jdk.compiler/com.sun.tools.javac.code.Scope$FilterImportScope.lambda$getSymbolsByName$0(Scope.java:971)
at jdk.compiler/com.sun.tools.javac.code.Scope$CompoundScope.lambda$getSymbolsByName$1(Scope.java:1098)
at jdk.compiler/com.sun.tools.javac.util.Iterators$CompoundIterator.hasNext(Iterators.java:75)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.findVar(Resolve.java:1553)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInternal(Resolve.java:2479)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdent(Resolve.java:2465)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveIdent(Resolve.java:2770)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:4341)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2710)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4408)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2576)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitTypeCast(Attr.java:4122)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:2249)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewArray(Attr.java:3126)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewArray.accept(JCTree.java:1971)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1317)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1066)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:770)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1463)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1136)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1244)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:960)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5664)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5550)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5302)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1346)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:968)
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.20251228_042550.args
---------- BEGIN SOURCE ----------
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
public class Main {
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
public @interface annotation { }
public static void main(String[] args) {
int[] array = new int[(@annotation int) Integer.MIN_VALUE];
}
}
---------- END SOURCE ----------
Attached code fails to compile on 11, 17, 21, 25 JDKs.
On 8 it does compile something, but prints warning. I dont know if resulted bytecode compiled with JDK 8 is valid.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Main.java
ACTUAL -
An exception has occurred in the compiler (25.0.1). 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.checkNonNull(Assert.java:62)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.fromAnnotations(Annotate.java:167)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateTypeSecondStage$0(Annotate.java:1069)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:198)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:322)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:703)
at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1472)
at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:1388)
at jdk.compiler/com.sun.tools.javac.comp.Check.importAccessible(Check.java:4480)
at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.lambda$resolveImports$1(TypeEnter.java:366)
at jdk.compiler/com.sun.tools.javac.code.Scope$FilterImportScope.lambda$getSymbolsByName$1(Scope.java:973)
at jdk.compiler/com.sun.tools.javac.util.Iterators$1.update(Iterators.java:100)
at jdk.compiler/com.sun.tools.javac.util.Iterators$1.<init>(Iterators.java:96)
at jdk.compiler/com.sun.tools.javac.util.Iterators.createFilterIterator(Iterators.java:95)
at jdk.compiler/com.sun.tools.javac.code.Scope$FilterImportScope.lambda$getSymbolsByName$0(Scope.java:971)
at jdk.compiler/com.sun.tools.javac.code.Scope$CompoundScope.lambda$getSymbolsByName$1(Scope.java:1098)
at jdk.compiler/com.sun.tools.javac.util.Iterators$CompoundIterator.hasNext(Iterators.java:75)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.findVar(Resolve.java:1553)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInternal(Resolve.java:2479)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdent(Resolve.java:2465)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveIdent(Resolve.java:2770)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:4341)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2710)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4408)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2576)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitTypeCast(Attr.java:4122)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:2249)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewArray(Attr.java:3126)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewArray.accept(JCTree.java:1971)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1317)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1066)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:770)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1463)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1136)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1244)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:960)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5664)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5550)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5302)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1346)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:968)
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.20251228_042550.args
---------- BEGIN SOURCE ----------
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
public class Main {
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
public @interface annotation { }
public static void main(String[] args) {
int[] array = new int[(@annotation int) Integer.MIN_VALUE];
}
}
---------- END SOURCE ----------