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

ClassFile Signature parsing fails for type parameter with no supertype

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 26
    • 25
    • core-libs
    • None

      JVMS 4.7.9.1 allows a type parameter to be constructed with neither a superclass nor any superinterface, for example F and G in this method signature:

      <A:Lone/Two;B:LOuter.Inner;C:[ID:LGeneric<*>;E:TA;F:G:>()V

      This signature string can be constructed in the classfile API model and be produced by signatureString(), but cannot be parsed back in MethodSignature::parseFrom.

      Offline discussion concludes that character restriction for identifier is sufficient to distinguish succeeding type parameter name from reference type signatures, thus requiring only an implementation change.

      Note: the signature above can be constructed in classfile API as:
      MethodSignature.of(
                              List.of(TypeParam.of("A", ClassTypeSig.of("one/Two")), // /
                                      TypeParam.of("B", ClassTypeSig.of(ClassTypeSig.of("Outer"), "Inner")), // .
                                      TypeParam.of("C", ArrayTypeSig.of(BaseTypeSig.of('I'))), // [
                                      TypeParam.of("D", ClassTypeSig.of("Generic", TypeArg.unbounded())), // <
                                      TypeParam.of("E", TypeVarSig.of("A")), // ;
                                      TypeParam.of("F", (ClassTypeSig) null), // :
                                      TypeParam.of("G", (ClassTypeSig) null)), // >
                              List.of(),
                              BaseTypeSig.of('V'))

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: