The attached program crashes javac. I've reproduced the crash on a 24 debug build and a 21 release build. I'm guessing some limit/check on the nesting level is missing?
$ javac TestNestedSynchronize800.java
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at jdk.compiler/com.sun.tools.javac.code.Types.hashCode(Types.java:4177)
at jdk.compiler/com.sun.tools.javac.code.Types.hashCode(Types.java:4173)
at jdk.compiler/com.sun.tools.javac.code.Types$UniqueType.hashCode(Types.java:4891)
at java.base/java.util.HashMap.hash(HashMap.java:338)
at java.base/java.util.HashMap.getNode(HashMap.java:577)
at java.base/java.util.HashMap.get(HashMap.java:565)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter$WriteablePoolHelper.writeIfNeeded(PoolWriter.java:351)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putClass(PoolWriter.java:119)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putConstant(PoolWriter.java:188)
at jdk.compiler/com.sun.tools.javac.jvm.Code.emitLdc(Code.java:405)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2373)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2571)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitParens(Gen.java:2092)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCParens.accept(JCTree.java:2075)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSynchronized(Gen.java:1488)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSynchronized.accept(JCTree.java:1469)
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.genTry(Gen.java:1559)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSynchronized(Gen.java:1513)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSynchronized.accept(JCTree.java:1469)
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)
...
$ javac TestNestedSynchronize800.java
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at jdk.compiler/com.sun.tools.javac.code.Types.hashCode(Types.java:4177)
at jdk.compiler/com.sun.tools.javac.code.Types.hashCode(Types.java:4173)
at jdk.compiler/com.sun.tools.javac.code.Types$UniqueType.hashCode(Types.java:4891)
at java.base/java.util.HashMap.hash(HashMap.java:338)
at java.base/java.util.HashMap.getNode(HashMap.java:577)
at java.base/java.util.HashMap.get(HashMap.java:565)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter$WriteablePoolHelper.writeIfNeeded(PoolWriter.java:351)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putClass(PoolWriter.java:119)
at jdk.compiler/com.sun.tools.javac.jvm.PoolWriter.putConstant(PoolWriter.java:188)
at jdk.compiler/com.sun.tools.javac.jvm.Code.emitLdc(Code.java:405)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2373)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2571)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitParens(Gen.java:2092)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCParens.accept(JCTree.java:2075)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSynchronized(Gen.java:1488)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSynchronized.accept(JCTree.java:1469)
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.genTry(Gen.java:1559)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSynchronized(Gen.java:1513)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSynchronized.accept(JCTree.java:1469)
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)
...
- relates to
-
JDK-8322992 Javac fails with StackOverflowError when compiling deeply nested synchronized blocks
- Resolved