Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213766

Assertion error in TypeAnnotations$TypeAnnotationPositions.resolveFrame

XMLWordPrintable

    • b83
    • 9
    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      The test for v11.0.1 and v1.8.0_191 were done using the Oracle JDK, those for 10.0.2 and 11.0.1 using the OpenJDK, but given the results I don’t think there is a distinction between the two.

      A DESCRIPTION OF THE PROBLEM :
      Attempting to compile the code attached below leads to an Assertion error. I could reproduce it with Java versions 12-ea19, 11.0.1 and 10.0.2 but not with 1.8.0_191.

      REGRESSION : Last worked in version 8u191

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Save the attached source code as TestBug.java and attempt to compile it with “javac TestBug.java”

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The file should be compiled into a .class file.
      ACTUAL -
      $ javac -version
      javac 11.0.1
      $ javac TestBug.java
      An exception has occurred in the compiler (11.0.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.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.code.TypeAnnotations$TypeAnnotationPositions.resolveFrame(TypeAnnotations.java:994)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.findPosition(TypeAnnotations.java:1416)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitAnnotatedType(TypeAnnotations.java:1289)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotatedType.accept(JCTree.java:2629)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitTypeApply(TreeScanner.java:325)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeApply.accept(JCTree.java:2375)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1271)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:956)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1282)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitLambda(TypeAnnotations.java:1220)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitApply(TreeScanner.java:238)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:213)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1282)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1189)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1122)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations.organizeTypeAnnotationsBodies(TypeAnnotations.java:146)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4713)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4574)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4503)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:951)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
              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.visitAnonymousClassDefinition(Attr.java:2397)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2288)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1689)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:702)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1773)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
              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:1020)
              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:1020)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:498)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:481)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:456)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:900)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:878)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:832)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:335)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:779)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:626)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:620)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1563)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1733)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1802)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1776)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1933)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$9.doLookup(Resolve.java:2622)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3293)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3543)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3528)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2618)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3484)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2243)
              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:1634)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:702)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1773)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
              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:1020)
              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:4683)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4574)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4503)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4448)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1341)
              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)

      $ /openjdk-12-ea19/bin/javac -version
      javac 12-ea
      $ /openjdk-12-ea19/bin/javac TestBug.java
      An exception has occurred in the compiler (12-ea). 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.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.code.TypeAnnotations$TypeAnnotationPositions.resolveFrame(TypeAnnotations.java:994)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.findPosition(TypeAnnotations.java:1408)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitAnnotatedType(TypeAnnotations.java:1289)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotatedType.accept(JCTree.java:2703)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitTypeApply(TreeScanner.java:331)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeApply.accept(JCTree.java:2449)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1271)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:962)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1282)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitLambda(TypeAnnotations.java:1220)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1880)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitApply(TreeScanner.java:244)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1707)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:218)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1517)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1282)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1189)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:872)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1122)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:780)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations.organizeTypeAnnotationsBodies(TypeAnnotations.java:146)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4908)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4769)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4698)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:964)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:780)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitAnonymousClassDefinition(Attr.java:2585)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2476)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1762)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:715)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1863)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1517)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1307)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1307)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:501)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:484)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:459)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:903)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:881)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1880)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:835)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:338)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:782)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:629)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:618)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1561)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1731)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1800)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1774)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1931)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$9.doLookup(Resolve.java:2620)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3291)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3541)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3526)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2616)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3679)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2317)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2194)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1707)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:715)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1863)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1517)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1307)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1111)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:872)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4878)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4769)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4698)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4643)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1341)
              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)

      $ /openjdk-10.0.2/bin/javac -version
      javac 10.0.2
      $ /openjdk-10.0.2/bin/javac TestBug.java
      An exception has occurred in the compiler (10.0.2). 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.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.code.TypeAnnotations$TypeAnnotationPositions.resolveFrame(TypeAnnotations.java:994)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.findPosition(TypeAnnotations.java:1416)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitAnnotatedType(TypeAnnotations.java:1289)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotatedType.accept(JCTree.java:2629)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitTypeApply(TreeScanner.java:325)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeApply.accept(JCTree.java:2375)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1271)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:956)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1282)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitLambda(TypeAnnotations.java:1220)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitApply(TreeScanner.java:238)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:213)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1282)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1189)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1122)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations.organizeTypeAnnotationsBodies(TypeAnnotations.java:146)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4752)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4613)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4542)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:949)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitAnonymousClassDefinition(Attr.java:2395)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2287)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1689)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:700)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1771)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:741)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1292)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:741)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1292)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:490)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:473)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:448)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:863)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:841)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:795)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:327)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.access$000(DeferredAttr.java:198)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:742)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:618)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:624)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1563)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1722)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1791)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1765)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1922)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$9.doLookup(Resolve.java:2614)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3269)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3519)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3504)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2610)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3487)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2243)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2004)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:700)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1771)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:741)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1292)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1096)
              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:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4722)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4613)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4542)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4487)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1333)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:306)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

      $ /jdk1.8.0_191/bin/javac -version
      javac 1.8.0_191
      $ /jdk1.8.0_191/bin/javac TestBug.java
      [no text output, TestBug.class generated as expected]

      ---------- BEGIN SOURCE ----------
      import java.lang.annotation.Target;
      import java.util.List;
      import java.util.function.Consumer;
      import java.util.function.Function;

      import static java.lang.annotation.ElementType.TYPE_USE;

      public abstract class TestBug
      {
          @Target({ TYPE_USE })
          public @interface TestAnnotation
          {
              // empty type annotation
          }

          // Accepting a Consumer<Consumer<>> instead of a function avoids the bug
          public abstract void get(final Function<Consumer<Runnable>, Object> function);

          public void buggyMethod()
          {
              // Extracting the argument to a variable avoids the bug
              get(consumer -> { // Turning this body block to an expression avoids the bug
                  new Runnable() {
                      @Override
                      public void run()
                      {
                          // Moving the buggy declaration here avoids the bug
                          consumer.accept(() -> {
                              // Removing the type annotation avoids the bug
                              final List<@TestAnnotation Object> buggyDeclaration;
                          });
                      }
                  };
                  return null;
              });
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The bug appears to be quite specific to the code structure, I have not been able to simplify the test code more than this. In my case this appeared in a much more complicated class; Consumer, Function and TestAnnotation were all custom classes and interfaces. In general, refactoring the code can avoid the error. (In my case, I moved the buggy declaration outside the Runnable.)

      FREQUENCY : always


            gli Guoxiong Li
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: