src/share/classes/com/sun/tools/javac/comp/Resolve.java

changeset 19
adaa3fc51b60
parent 1
9a66ca7c79fa
child 40
8852d96b593b
equal deleted inserted replaced
18:aeaa0f482b28 19:adaa3fc51b60
405 */ 405 */
406 Symbol findField(Env<AttrContext> env, 406 Symbol findField(Env<AttrContext> env,
407 Type site, 407 Type site,
408 Name name, 408 Name name,
409 TypeSymbol c) { 409 TypeSymbol c) {
410 while (c.type.tag == TYPEVAR)
411 c = c.type.getUpperBound().tsym;
410 Symbol bestSoFar = varNotFound; 412 Symbol bestSoFar = varNotFound;
411 Symbol sym; 413 Symbol sym;
412 Scope.Entry e = c.members().lookup(name); 414 Scope.Entry e = c.members().lookup(name);
413 while (e.scope != null) { 415 while (e.scope != null) {
414 if (e.sym.kind == VAR && (e.sym.flags_field & SYNTHETIC) == 0) { 416 if (e.sym.kind == VAR && (e.sym.flags_field & SYNTHETIC) == 0) {
416 ? e.sym : new AccessError(env, site, e.sym); 418 ? e.sym : new AccessError(env, site, e.sym);
417 } 419 }
418 e = e.next(); 420 e = e.next();
419 } 421 }
420 Type st = types.supertype(c.type); 422 Type st = types.supertype(c.type);
421 if (st != null && st.tag == CLASS) { 423 if (st != null && (st.tag == CLASS || st.tag == TYPEVAR)) {
422 sym = findField(env, site, name, st.tsym); 424 sym = findField(env, site, name, st.tsym);
423 if (sym.kind < bestSoFar.kind) bestSoFar = sym; 425 if (sym.kind < bestSoFar.kind) bestSoFar = sym;
424 } 426 }
425 for (List<Type> l = types.interfaces(c.type); 427 for (List<Type> l = types.interfaces(c.type);
426 bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); 428 bestSoFar.kind != AMBIGUOUS && l.nonEmpty();
731 boolean abstractok, 733 boolean abstractok,
732 Symbol bestSoFar, 734 Symbol bestSoFar,
733 boolean allowBoxing, 735 boolean allowBoxing,
734 boolean useVarargs, 736 boolean useVarargs,
735 boolean operator) { 737 boolean operator) {
736 for (Type ct = intype; ct.tag == CLASS; ct = types.supertype(ct)) { 738 for (Type ct = intype; ct.tag == CLASS || ct.tag == TYPEVAR; ct = types.supertype(ct)) {
739 while (ct.tag == TYPEVAR)
740 ct = ct.getUpperBound();
737 ClassSymbol c = (ClassSymbol)ct.tsym; 741 ClassSymbol c = (ClassSymbol)ct.tsym;
738 if ((c.flags() & (ABSTRACT | INTERFACE)) == 0) 742 if ((c.flags() & (ABSTRACT | INTERFACE)) == 0)
739 abstractok = false; 743 abstractok = false;
740 for (Scope.Entry e = c.members().lookup(name); 744 for (Scope.Entry e = c.members().lookup(name);
741 e.scope != null; 745 e.scope != null;

mercurial