}
public Type capture(Type t) {
if (t.tag != CLASS)
return t;
if (t.getEnclosingType() != Type.noType) {
Type capturedEncl = capture(t.getEnclosingType());
if (capturedEncl != t.getEnclosingType()) {
Type type1 = memberType(capturedEncl, t.tsym);
t = subst(type1, t.tsym.type.getTypeArguments(), t.getTypeArguments());
}
}
ClassType cls = (ClassType)t;
if (cls.isRaw() || !cls.isParameterized())
return cls;
ClassType G = (ClassType)cls.asElement().asType();
List<Type> A = G.getTypeArguments();
List<Type> T = cls.getTypeArguments();
List<Type> S = freshTypeVariables(T);
List<Type> currentA = A;
List<Type> currentT = T;
List<Type> currentS = S;
boolean captured = false;
while (!currentA.isEmpty() &&
!currentT.isEmpty() &&
!currentS.isEmpty()) {
if (currentS.head != currentT.head) {
captured = true;
WildcardType Ti = (WildcardType)currentT.head;
Type Ui = currentA.head.getUpperBound();
CapturedType Si = (CapturedType)currentS.head;
if (Ui == null)
Ui = syms.objectType;
switch (Ti.kind) {
case UNBOUND: