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

javac crashes on accessibility check with method reference with typevar receiver

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8, 8-repo-lambda
    • Fix Version/s: 8
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b102
    • Verification:
      Verified

      Description

      import java.util.*;

      class CompilerCrash {
          private static <T> T[] clone(T[] array) {
              return Arrays.stream(array)
                           .map(T::clone)
                           .collect(Collectors.toList())
                           .toArray(array);
          }
          public static void main(String... args) {
              clone(args);
          }
      }


      stack trace:

      An exception has occurred in the compiler (1.8.0-internal). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError: isSubClass T
      at com.sun.tools.javac.code.Symbol.isSubClass(Symbol.java:445)
      at com.sun.tools.javac.comp.Resolve.isProtectedAccessible(Resolve.java:433)
      at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:389)
      at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:359)
      at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1436)
      at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1597)
      at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1669)
      at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1641)
      at com.sun.tools.javac.comp.Resolve$MethodReferenceLookupHelper.lookup(Resolve.java:2848)
      at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3004)
      at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:2989)
      at com.sun.tools.javac.comp.Resolve.resolveMemberReference(Resolve.java:2681)
      at com.sun.tools.javac.comp.Attr.visitReference(Attr.java:2726)
      at com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:1951)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:314)
      at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:246)
      at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:213)
      at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:201)
      at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:968)
      at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:814)
      at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:725)
      at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:823)
      at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:156)
      at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:560)
      at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1419)
      at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1597)
      at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1669)
      at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1641)
      at com.sun.tools.javac.comp.Resolve$9.lookup(Resolve.java:2335)
      at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3004)
      at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2332)
      at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2326)
      at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3375)
      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3269)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1882)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1828)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3242)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1882)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1828)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3242)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1882)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1828)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1692)
      at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1378)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:643)
      at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:659)
      at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1130)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:903)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:643)
      at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1017)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:772)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:574)
      at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:643)
      at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4321)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4229)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4164)
      at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4138)
      at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1224)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:877)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:836)
      at com.sun.tools.javac.main.Main.compile(Main.java:517)
      at com.sun.tools.javac.main.Main.compile(Main.java:376)
      at com.sun.tools.javac.main.Main.compile(Main.java:365)
      at com.sun.tools.javac.main.Main.compile(Main.java:356)
      at com.sun.tools.javac.Main.compile(Main.java:77)
      at com.sun.tools.javac.Main.main(Main.java:62)

        Attachments

          Activity

            People

            Assignee:
            mcimadamore Maurizio Cimadamore
            Reporter:
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: