1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jul 17 14:09:46 2013 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jul 17 14:11:41 2013 +0100 1.3 @@ -961,10 +961,23 @@ 1.4 DeferredType dt = (DeferredType)found; 1.5 return dt.check(this); 1.6 } else { 1.7 - return super.check(pos, chk.checkNonVoid(pos, types.capture(types.upperBound(found.baseType())))); 1.8 + return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType())))); 1.9 } 1.10 } 1.11 1.12 + /** 1.13 + * javac has a long-standing 'simplification' (see 6391995): 1.14 + * given an actual argument type, the method check is performed 1.15 + * on its upper bound. This leads to inconsistencies when an 1.16 + * argument type is checked against itself. For example, given 1.17 + * a type-variable T, it is not true that {@code U(T) <: T}, 1.18 + * so we need to guard against that. 1.19 + */ 1.20 + private Type U(Type found) { 1.21 + return found == pt ? 1.22 + found : types.upperBound(found); 1.23 + } 1.24 + 1.25 @Override 1.26 protected MethodResultInfo dup(Type newPt) { 1.27 return new MethodResultInfo(newPt, checkContext);