equal
deleted
inserted
replaced
165 public Type cvarLowerBound(Type t) { |
165 public Type cvarLowerBound(Type t) { |
166 if (t.hasTag(TYPEVAR) && ((TypeVar) t).isCaptured()) { |
166 if (t.hasTag(TYPEVAR) && ((TypeVar) t).isCaptured()) { |
167 return cvarLowerBound(t.getLowerBound()); |
167 return cvarLowerBound(t.getLowerBound()); |
168 } |
168 } |
169 else return t; |
169 else return t; |
|
170 } |
|
171 |
|
172 /** |
|
173 * Recursively skip type-variables until a class/array type is found; capture conversion is then |
|
174 * (optionally) applied to the resulting type. This is useful for i.e. computing a site that is |
|
175 * suitable for a method lookup. |
|
176 */ |
|
177 public Type skipTypeVars(Type site, boolean capture) { |
|
178 while (site.hasTag(TYPEVAR)) { |
|
179 site = site.getUpperBound(); |
|
180 } |
|
181 return capture ? capture(site) : site; |
170 } |
182 } |
171 // </editor-fold> |
183 // </editor-fold> |
172 |
184 |
173 // <editor-fold defaultstate="collapsed" desc="isUnbounded"> |
185 // <editor-fold defaultstate="collapsed" desc="isUnbounded"> |
174 /** |
186 /** |
1785 |
1797 |
1786 return !isSubtype(t, relaxBound(s)); |
1798 return !isSubtype(t, relaxBound(s)); |
1787 } |
1799 } |
1788 |
1800 |
1789 private Type relaxBound(Type t) { |
1801 private Type relaxBound(Type t) { |
1790 if (t.hasTag(TYPEVAR)) { |
1802 return (t.hasTag(TYPEVAR)) ? |
1791 while (t.hasTag(TYPEVAR)) |
1803 rewriteQuantifiers(skipTypeVars(t, false), true, true) : |
1792 t = t.getUpperBound(); |
1804 t; |
1793 t = rewriteQuantifiers(t, true, true); |
|
1794 } |
|
1795 return t; |
|
1796 } |
1805 } |
1797 // </editor-fold> |
1806 // </editor-fold> |
1798 |
1807 |
1799 // <editor-fold defaultstate="collapsed" desc="isReifiable"> |
1808 // <editor-fold defaultstate="collapsed" desc="isReifiable"> |
1800 public boolean isReifiable(Type t) { |
1809 public boolean isReifiable(Type t) { |
1870 /** |
1879 /** |
1871 * Mapping to take element type of an arraytype |
1880 * Mapping to take element type of an arraytype |
1872 */ |
1881 */ |
1873 private Mapping elemTypeFun = new Mapping ("elemTypeFun") { |
1882 private Mapping elemTypeFun = new Mapping ("elemTypeFun") { |
1874 public Type apply(Type t) { |
1883 public Type apply(Type t) { |
1875 while (t.hasTag(TYPEVAR)) { |
1884 return elemtype(skipTypeVars(t, false)); |
1876 t = t.getUpperBound(); |
|
1877 } |
|
1878 return elemtype(t); |
|
1879 } |
1885 } |
1880 }; |
1886 }; |
1881 |
1887 |
1882 /** |
1888 /** |
1883 * The number of dimensions of an array type. |
1889 * The number of dimensions of an array type. |
2660 } |
2666 } |
2661 } |
2667 } |
2662 |
2668 |
2663 private MethodSymbol implementationInternal(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) { |
2669 private MethodSymbol implementationInternal(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) { |
2664 for (Type t = origin.type; t.hasTag(CLASS) || t.hasTag(TYPEVAR); t = supertype(t)) { |
2670 for (Type t = origin.type; t.hasTag(CLASS) || t.hasTag(TYPEVAR); t = supertype(t)) { |
2665 while (t.hasTag(TYPEVAR)) |
2671 t = skipTypeVars(t, false); |
2666 t = t.getUpperBound(); |
|
2667 TypeSymbol c = t.tsym; |
2672 TypeSymbol c = t.tsym; |
2668 Symbol bestSoFar = null; |
2673 Symbol bestSoFar = null; |
2669 for (Symbol sym : c.members().getSymbolsByName(ms.name, implFilter)) { |
2674 for (Symbol sym : c.members().getSymbolsByName(ms.name, implFilter)) { |
2670 if (sym != null && sym.overrides(ms, origin, Types.this, checkResult)) { |
2675 if (sym != null && sym.overrides(ms, origin, Types.this, checkResult)) { |
2671 bestSoFar = sym; |
2676 bestSoFar = sym; |