Consider the following clause from the JLS §13.1
The binary name of a type variable declared by a generic class or interface (§8.1.2, §9.1.2) is the binary name of its immediately enclosing type, followed by $, followed by the simple name of the type variable.
The binary name of a type variable declared by a generic method (§8.4.4) is the binary name of the type declaring the method, followed by $, followed by the descriptor of the method as defined in The Java Virtual Machine Specification, Java SE 7 Edition, followed by $, followed by the simple name of the type variable.
The binary name of a type variable declared by a generic constructor (§8.8.4) is the binary name of the type declaring the constructor, followed by $, followed by the descriptor of the constructor as defined in The Java Virtual Machine Specification, Java SE 7 Edition, followed by $, followed by the simple name of the type variable.
Following are my doubts:
- Why is binary naming conventions dictated for the Type Variables declared in the Class/Interface/Methods/Constructors?
- Ideally this should't have been - as they are always referred to wrt the class of which they are members of.
- Also Binary names are used to refer to the class/Interfaces that have an independent representation as a
.classfile - not for the Type Variables.
- Any example program which I can decompile to see if this is practically happening?
- eg when decompiling the anonymous classes - I can verify the naming conventions being declared to be true.
- Not Not able to find any example - where Binary Name is getting generated for the Type Variable.