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

AssertionError in DeferredAttr with parenthesized method reference

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 10, 11
    • Fix Version/s: 11
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b18

      Backports

        Description

        The following ill-formed program crashes javac 11-ea+14. Removing the extra parens around `(I::v)` works around the crash and allows an error to be reported.

        ```
        import java.util.Arrays;
        import java.util.stream.Collectors;
        import java.util.stream.Stream;

        class Test {

          interface I {
            String k();

            String v();
          }

          void f(Stream<I> xs) {
            xs.collect(Collectors.toMap(I::k, Arrays.asList((I::v))));
          }
        }
        ```

        ```
        javac -fullversion Test.java
        javac full version "11-ea+14"
        An exception has occurred in the compiler (11-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.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitReference(DeferredAttr.java:882)
                at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:2190)
                at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
                at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitParens(TreeScanner.java:264)
                at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCParens.accept(JCTree.java:1847)
                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)
        ```

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  cushon Liam Miller-Cushon
                  Reporter:
                  cushon Liam Miller-Cushon
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: