src/share/classes/com/sun/tools/javac/code/Symbol.java

changeset 341
85fecace920b
parent 308
03944ee4fac4
child 428
2485f5641ed0
equal deleted inserted replaced
340:c2dfab9e2f39 341:85fecace920b
1195 /** The implementation of this (abstract) symbol in class origin; 1195 /** The implementation of this (abstract) symbol in class origin;
1196 * null if none exists. Synthetic methods are not considered 1196 * null if none exists. Synthetic methods are not considered
1197 * as possible implementations. 1197 * as possible implementations.
1198 */ 1198 */
1199 public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) { 1199 public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) {
1200 for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = types.supertype(t)) { 1200 MethodSymbol res = types.implementation(this, origin, types, checkResult);
1201 while (t.tag == TYPEVAR) 1201 if (res != null)
1202 t = t.getUpperBound(); 1202 return res;
1203 TypeSymbol c = t.tsym;
1204 for (Scope.Entry e = c.members().lookup(name);
1205 e.scope != null;
1206 e = e.next()) {
1207 if (e.sym.kind == MTH) {
1208 MethodSymbol m = (MethodSymbol) e.sym;
1209 if (m.overrides(this, origin, types, checkResult) &&
1210 (m.flags() & SYNTHETIC) == 0)
1211 return m;
1212 }
1213 }
1214 }
1215 // if origin is derived from a raw type, we might have missed 1203 // if origin is derived from a raw type, we might have missed
1216 // an implementation because we do not know enough about instantiations. 1204 // an implementation because we do not know enough about instantiations.
1217 // in this case continue with the supertype as origin. 1205 // in this case continue with the supertype as origin.
1218 if (types.isDerivedRaw(origin.type)) 1206 if (types.isDerivedRaw(origin.type))
1219 return implementation(types.supertype(origin.type).tsym, types, checkResult); 1207 return implementation(types.supertype(origin.type).tsym, types, checkResult);

mercurial