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
diff --git a/pom.xml b/pom.xml
index ddec737..913b4a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,6 +48,14 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <scope>system</scope>
+ <optional>true</optional>
+ <version>1.8</version>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>