equal
deleted
inserted
replaced
1983 /** |
1983 /** |
1984 * Returns true iff the first signature is a <em>sub |
1984 * Returns true iff the first signature is a <em>sub |
1985 * signature</em> of the other. This is <b>not</b> an equivalence |
1985 * signature</em> of the other. This is <b>not</b> an equivalence |
1986 * relation. |
1986 * relation. |
1987 * |
1987 * |
1988 * @see "The Java Language Specification, Third Ed. (8.4.2)." |
1988 * @jls section 8.4.2. |
1989 * @see #overrideEquivalent(Type t, Type s) |
1989 * @see #overrideEquivalent(Type t, Type s) |
1990 * @param t first signature (possibly raw). |
1990 * @param t first signature (possibly raw). |
1991 * @param s second signature (could be subjected to erasure). |
1991 * @param s second signature (could be subjected to erasure). |
1992 * @return true if t is a sub signature of s. |
1992 * @return true if t is a sub signature of s. |
1993 */ |
1993 */ |
2002 /** |
2002 /** |
2003 * Returns true iff these signatures are related by <em>override |
2003 * Returns true iff these signatures are related by <em>override |
2004 * equivalence</em>. This is the natural extension of |
2004 * equivalence</em>. This is the natural extension of |
2005 * isSubSignature to an equivalence relation. |
2005 * isSubSignature to an equivalence relation. |
2006 * |
2006 * |
2007 * @see "The Java Language Specification, Third Ed. (8.4.2)." |
2007 * @jls section 8.4.2. |
2008 * @see #isSubSignature(Type t, Type s) |
2008 * @see #isSubSignature(Type t, Type s) |
2009 * @param t a signature (possible raw, could be subjected to |
2009 * @param t a signature (possible raw, could be subjected to |
2010 * erasure). |
2010 * erasure). |
2011 * @param s a signature (possible raw, could be subjected to |
2011 * @param s a signature (possible raw, could be subjected to |
2012 * erasure). |
2012 * erasure). |
3047 return covariantReturnType(tres, sres, warner); |
3047 return covariantReturnType(tres, sres, warner); |
3048 } |
3048 } |
3049 |
3049 |
3050 /** |
3050 /** |
3051 * Return-Type-Substitutable. |
3051 * Return-Type-Substitutable. |
3052 * @see <a href="http://java.sun.com/docs/books/jls/">The Java |
3052 * @jls section 8.4.5 |
3053 * Language Specification, Third Ed. (8.4.5)</a> |
|
3054 */ |
3053 */ |
3055 public boolean returnTypeSubstitutable(Type r1, Type r2) { |
3054 public boolean returnTypeSubstitutable(Type r1, Type r2) { |
3056 if (hasSameArgs(r1, r2)) |
3055 if (hasSameArgs(r1, r2)) |
3057 return resultSubtype(r1, r2, Warner.noWarnings); |
3056 return resultSubtype(r1, r2, Warner.noWarnings); |
3058 else |
3057 else |
3128 } |
3127 } |
3129 // </editor-fold> |
3128 // </editor-fold> |
3130 |
3129 |
3131 // <editor-fold defaultstate="collapsed" desc="Capture conversion"> |
3130 // <editor-fold defaultstate="collapsed" desc="Capture conversion"> |
3132 /* |
3131 /* |
3133 * JLS 3rd Ed. 5.1.10 Capture Conversion: |
3132 * JLS 5.1.10 Capture Conversion: |
3134 * |
3133 * |
3135 * Let G name a generic type declaration with n formal type |
3134 * Let G name a generic type declaration with n formal type |
3136 * parameters A1 ... An with corresponding bounds U1 ... Un. There |
3135 * parameters A1 ... An with corresponding bounds U1 ... Un. There |
3137 * exists a capture conversion from G<T1 ... Tn> to G<S1 ... Sn>, |
3136 * exists a capture conversion from G<T1 ... Tn> to G<S1 ... Sn>, |
3138 * where, for 1 <= i <= n: |
3137 * where, for 1 <= i <= n: |
3161 * therefore never throw an exception at run time. |
3160 * therefore never throw an exception at run time. |
3162 * |
3161 * |
3163 * Capture conversion is not applied recursively. |
3162 * Capture conversion is not applied recursively. |
3164 */ |
3163 */ |
3165 /** |
3164 /** |
3166 * Capture conversion as specified by JLS 3rd Ed. |
3165 * Capture conversion as specified by the JLS. |
3167 */ |
3166 */ |
3168 |
3167 |
3169 public List<Type> capture(List<Type> ts) { |
3168 public List<Type> capture(List<Type> ts) { |
3170 List<Type> buf = List.nil(); |
3169 List<Type> buf = List.nil(); |
3171 for (Type t : ts) { |
3170 for (Type t : ts) { |