-
Bug
-
Resolution: Fixed
-
P4
-
25
-
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'))
<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'))
- relates to
-
JDK-8351103 JVMS class signature specification disagrees with implementation
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/1cd186c7
-
Review(master) openjdk/jdk/27439