1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu Mar 03 17:32:35 2011 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Thu Mar 03 17:34:58 2011 +0000 1.3 @@ -1992,7 +1992,11 @@ 1.4 * @return true if t is a sub signature of s. 1.5 */ 1.6 public boolean isSubSignature(Type t, Type s) { 1.7 - return hasSameArgs(t, s) || hasSameArgs(t, erasure(s)); 1.8 + return isSubSignature(t, s, true); 1.9 + } 1.10 + 1.11 + public boolean isSubSignature(Type t, Type s, boolean strict) { 1.12 + return hasSameArgs(t, s, strict) || hasSameArgs(t, erasure(s), strict); 1.13 } 1.14 1.15 /** 1.16 @@ -2129,10 +2133,24 @@ 1.17 * where correspondence is by position in the type parameter list. 1.18 */ 1.19 public boolean hasSameArgs(Type t, Type s) { 1.20 + return hasSameArgs(t, s, true); 1.21 + } 1.22 + 1.23 + public boolean hasSameArgs(Type t, Type s, boolean strict) { 1.24 + return hasSameArgs(t, s, strict ? hasSameArgs_strict : hasSameArgs_nonstrict); 1.25 + } 1.26 + 1.27 + private boolean hasSameArgs(Type t, Type s, TypeRelation hasSameArgs) { 1.28 return hasSameArgs.visit(t, s); 1.29 } 1.30 // where 1.31 - private TypeRelation hasSameArgs = new TypeRelation() { 1.32 + private class HasSameArgs extends TypeRelation { 1.33 + 1.34 + boolean strict; 1.35 + 1.36 + public HasSameArgs(boolean strict) { 1.37 + this.strict = strict; 1.38 + } 1.39 1.40 public Boolean visitType(Type t, Type s) { 1.41 throw new AssertionError(); 1.42 @@ -2147,7 +2165,7 @@ 1.43 @Override 1.44 public Boolean visitForAll(ForAll t, Type s) { 1.45 if (s.tag != FORALL) 1.46 - return false; 1.47 + return strict ? false : visitMethodType(t.asMethodType(), s); 1.48 1.49 ForAll forAll = (ForAll)s; 1.50 return hasSameBounds(t, forAll) 1.51 @@ -2159,6 +2177,10 @@ 1.52 return false; 1.53 } 1.54 }; 1.55 + 1.56 + TypeRelation hasSameArgs_strict = new HasSameArgs(true); 1.57 + TypeRelation hasSameArgs_nonstrict = new HasSameArgs(false); 1.58 + 1.59 // </editor-fold> 1.60 1.61 // <editor-fold defaultstate="collapsed" desc="subst">