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

AssertionError in DeferredAttr at setOverloadKind

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Same behaviour under Linux and Windows.

      A DESCRIPTION OF THE PROBLEM :
      With javac 11.0.5+10-LTS the following program does not compile.

      May be related to JDK-8203679.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to compile above program with javac.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      This class should compile an run.
      ACTUAL -
      javac full version "11.0.5+10-LTS"
      An exception has occurred in the compiler (11.0.5). 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.check(Assert.java:46)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$2$1.setOverloadKind(DeferredAttr.java:172)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitReference(ArgumentAttr.java:277)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:2191)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:751)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1997)
              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.visitReturn(Attr.java:1866)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1546)
              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$10.doLookup(Resolve.java:2654)
              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.resolveQualifiedMethod(Resolve.java:2651)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2645)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3721)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3601)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2110)
              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.visitSelect(Attr.java:3573)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2110)
              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.DeferredAttr$4.complete(DeferredAttr.java:374)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr$ArgumentType.complete(ArgumentAttr.java:364)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:335)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:321)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1060)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:887)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:775)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:896)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:618)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:644)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4120)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3913)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3814)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:3803)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3553)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2244)
              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)


      ---------- BEGIN SOURCE ----------
      import java.util.Arrays;
      import java.util.List;
      import java.util.stream.Collectors;
      import java.util.stream.Stream;

      public class Main {
          public static void main(String[] args) {
              Stream<String> values = Stream.of("a", "b");
              String[] excludeValues = {"a"};

              someFunction(
                      values.filter(l -> {
                          return Arrays.stream(excludeValues).anyMatch(l::contains);
                      }).collect(Collectors.toList())
              );
          }

          private static void someFunction(List<String> collect) {
              System.out.println(collect);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      - Replace statement lambda with expression lambda
      - Store the result of collect in a local variable before calling someFunction.
      - Javac Versions that are not effected: 1.8.0_232-b09, 13.0.1+9


      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fmatte Fairoz Matte
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: