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

ClassCastException: Type$TypeMapping$3 cannot be cast to Type$WildcardType

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 13
    • None
    • tools
    • None
    • generic
    • generic


      In following up this message: http://mail.openjdk.java.net/pipermail/compiler-dev/2016-October/010450.html, Alex Buckley observed:

      "on JDK 9b140, javac crashes if the declaration of i uses a
      bounded wildcard for B's type argument -- say B<? extends Number>.I"

      I verified that claim against JDK9 tip using this case:

      class A<X> { class I {} }
      class Test {
        class B<Y> extends A<Y[]> {}
        B<? extends Number>.I i;
      }

      and I am able to reproduce the crash:

      java.lang.ClassCastException: com.sun.tools.javac.code.Type$TypeMapping$3 (in module: jdk.compiler) cannot be cast to com.sun.tools.javac.code.Type$WildcardType (in module: jdk.compiler)
      at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.validateAnnotatedType(jdk.compiler@9-internal/Attr.java:4805)
      at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.validateAnnotatedType(jdk.compiler@9-internal/Attr.java:4766)
      at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitVarDef(jdk.compiler@9-internal/Attr.java:4677)
      at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(jdk.compiler@9-internal/JCTree.java:936)
      at com.sun.tools.javac.tree.TreeScanner.scan(jdk.compiler@9-internal/TreeScanner.java:49)


       

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: