Fix type canonicalization of recursive types, and wildcards
Instantiate types recursively; previously [T/e]A<T> worked but
[T/e]A<B<T>> didn't.
Also handle instantiating arrays with parametric element types, which
can't appear as top-level types during canonicalization but can appear
as type arguments (e.g. [T/e]A<T[]> -> A<e[]>).
The array instantiation case is interesting because it allows the
creation of arrays with wildcard element types. The JVMS signature
grammar [1] doesn't actually allow that, but both javac and ecj can be
coerced into emitting it:
class A<X> { class I {} }
class Test {
class B<Y> extends A<Y[]> {}
B<?>.I i; // LA<[*>.I;
}
To support this, restructure the type and signature models to make
wildcards first-class types, instead of only allowing them as top-level
type arguments.
[1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1
MOE_MIGRATED_REVID=137101539
17 files changed