-
Bug
-
Resolution: Not an Issue
-
P5
-
None
-
8
-
None
ClassTypeSignatures are essentially sequences of dot-delimited "Identifiers", with some optional type arguments thrown in. However, the correspondence between Identifiers and class names is unclear.
There is this: "the terminal symbol Identifier is used to denote the name of a type ... as generated by the Java compiler"
But the compiler-generated name of an inner class may be considered "Outer$Inner" or "Outer.Inner", depending on context.
Longstanding behavior is as follows:
- Inner classes of parameterized class types are encoded with, e.g., 'LOuter<TT;>.Inner;'
- Inner classes of non-generic classes are encoded with, e.g., 'LOuter$Inner;'
- Inner classes of raw class types are encoded with, e.g., 'LOuter$Inner;'
- Inner classes multiple levels deep may mix delimiters, e.g. 'LA$B<TT;>.C.D;'
JVMS 4.7.9 limits its rules about correctness to syntax; but, to some extent, it endorses the semantic checks performed by java.lang.reflect. In the Oracle JDK, this includes that every class mentioned before a '.' symbol has the correct number of type arguments. Hence, the GenericSignatureFormatError promptingJDK-8037934, which complains that, where Outer is generic, 'LOuter.Inner;' is not well-formed (the type arguments are missing).
So, in general, both '$' and '.' may be used as delimiters, although type arguments must precede a '.' (or ';'), and raw types must precede a '$' (or '.'). It may be useful to simply state informally in 4.7.9.1 that it is acceptable to use '$' in the name of an inner class.
There is this: "the terminal symbol Identifier is used to denote the name of a type ... as generated by the Java compiler"
But the compiler-generated name of an inner class may be considered "Outer$Inner" or "Outer.Inner", depending on context.
Longstanding behavior is as follows:
- Inner classes of parameterized class types are encoded with, e.g., 'LOuter<TT;>.Inner;'
- Inner classes of non-generic classes are encoded with, e.g., 'LOuter$Inner;'
- Inner classes of raw class types are encoded with, e.g., 'LOuter$Inner;'
- Inner classes multiple levels deep may mix delimiters, e.g. 'LA$B<TT;>.C.D;'
JVMS 4.7.9 limits its rules about correctness to syntax; but, to some extent, it endorses the semantic checks performed by java.lang.reflect. In the Oracle JDK, this includes that every class mentioned before a '.' symbol has the correct number of type arguments. Hence, the GenericSignatureFormatError prompting
So, in general, both '$' and '.' may be used as delimiters, although type arguments must precede a '.' (or ';'), and raw types must precede a '$' (or '.'). It may be useful to simply state informally in 4.7.9.1 that it is acceptable to use '$' in the name of an inner class.
- relates to
-
JDK-8050472 javac could generate more accurate signatures for local classes
-
- Closed
-