SUGGESTED FIX
Index: j2se/src/share/classes/com/sun/tools/javac/code/Types.java
--- /tmp/geta9696 2006-11-26 22:28:10.000000000 -0800
+++ /tmp/getb9696 2006-11-26 22:28:10.000000000 -0800
@@ -776,14 +776,16 @@
}
void debugContainsType(WildcardType t, Type s) {
+ System.err.println();
+ System.err.format(" does %s contain %s?%n", t, s);
System.err.format(" %s U(%s) <: U(%s) %s = %s%n",
- upperBound(s), s, t, upperBound(t),
+ upperBound(s), s, t, U(t),
t.isSuperBound()
- || isSubtypeNoCapture(upperBound(s), upperBound(t)));
+ || isSubtypeNoCapture(upperBound(s), U(t)));
System.err.format(" %s L(%s) <: L(%s) %s = %s%n",
- lowerBound(t), t, s, lowerBound(s),
+ L(t), t, s, lowerBound(s),
t.isExtendsBound()
- || isSubtypeNoCapture(lowerBound(t), lowerBound(s)));
+ || isSubtypeNoCapture(L(t), lowerBound(s)));
System.err.println();
}
@@ -793,8 +795,10 @@
return containedBy(s, t);
else {
// debugContainsType(t, s);
- return (t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s)))
- && (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t)));
+ return isSameWildcard(t, s)
+ || isCaptureOf(s, t)
+ || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s))) &&
+ (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t))));
}
}
@@ -812,6 +816,19 @@
}
};
+ public boolean isCaptureOf(Type s, WildcardType t) {
+ if (s.tag != TYPEVAR || !(s instanceof CapturedType))
+ return false;
+ return isSameWildcard(t, ((CapturedType)s).wildcard);
+ }
+
+ public boolean isSameWildcard(WildcardType t, Type s) {
+ if (s.tag != WILDCARD)
+ return false;
+ WildcardType w = (WildcardType)s;
+ return w.kind == t.kind && w.type == t.type;
+ }
+
public boolean containsTypeEquivalent(List<Type> ts, List<Type> ss) {
while (ts.nonEmpty() && ss.nonEmpty()
&& containsTypeEquivalent(ts.head, ss.head)) {
|