Signature model issues
-
liangchenblue at gmail.com
Wed Mar 1 21:02:54 UTC 2023
Hi,
While reviewing the Signature move proposal, I found a few issue with
this model:
1. Signature.TypeArg specifically represents wildcards, which is one
of the type arguments (the other being reference types represented by
Signature.RefTypeSig). Thus, the current model allows passing in a
wildcard as a bound of another wildcard, which is illegal in both the
Java language and JVM.
I recommend renaming Signature.TypeArg to Signature.WildcardSig and
make it directly extend Signature instead (or add another common
superinterface for wildcard and ref type signatures).
2. Another issue with the model is ClassTypeSig does not validate its
input, so it's currently possible to pass a base type or void
signature as a type argument, which is illegal as well, and it won't
cause an error. If we have the common superinterface recommended
above, we can control such malformed inputs.
More information about the classfile-api-dev
mailing list