diff -r 6e0f31d61e56 -r 4788eb38cac5 src/share/classes/com/sun/tools/javac/code/Types.java --- a/src/share/classes/com/sun/tools/javac/code/Types.java Sat Nov 09 15:24:38 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Mon Nov 11 09:47:46 2013 -0500 @@ -244,7 +244,7 @@ public Type visitClassType(ClassType t, Symbol sym) { if (t.tsym == sym) return t; - Type base = asSuper(sym.type, t); + Type base = asSuper(sym.type, t.tsym); if (base == null) return null; ListBuffer from = new ListBuffer(); @@ -687,7 +687,7 @@ (t.flags() & SYNTHETIC) == 0; } }; - private boolean pendingBridges(ClassSymbol origin, TypeSymbol sym) { + private boolean pendingBridges(ClassSymbol origin, TypeSymbol s) { //a symbol will be completed from a classfile if (a) symbol has //an associated file object with CLASS kind and (b) the symbol has //not been entered @@ -696,11 +696,11 @@ enter.getEnv(origin) == null) { return false; } - if (origin == sym) { + if (origin == s) { return true; } for (Type t : interfaces(origin.type)) { - if (pendingBridges((ClassSymbol)t.tsym, sym)) { + if (pendingBridges((ClassSymbol)t.tsym, s)) { return true; } } @@ -761,7 +761,7 @@ } else if (t.hasTag(TYPEVAR)) { return isSubtypeUnchecked(t.getUpperBound(), s, warn); } else if (!s.isRaw()) { - Type t2 = asSuper(t, s); + Type t2 = asSuper(t, s.tsym); if (t2 != null && t2.isRaw()) { if (isReifiable(s)) { warn.silentWarn(LintCategory.UNCHECKED); @@ -914,7 +914,7 @@ @Override public Boolean visitClassType(ClassType t, Type s) { - Type sup = asSuper(t, s); + Type sup = asSuper(t, s.tsym); return sup != null && sup.tsym == s.tsym // You're not allowed to write @@ -1935,42 +1935,30 @@ * @param t a type * @param sym a symbol */ - public Type asSuper(Type t, Symbol s) { - return asSuper(t, s.type); - } - - public Type asSuper(Type t, Type s) { - return asSuper.visit(t, s); + public Type asSuper(Type t, Symbol sym) { + return asSuper.visit(t, sym); } // where - private SimpleVisitor asSuper = new SimpleVisitor() { - - public Type visitType(Type t, Type s) { + private SimpleVisitor asSuper = new SimpleVisitor() { + + public Type visitType(Type t, Symbol sym) { return null; } @Override - public Type visitClassType(ClassType t, Type s) { - if (t.tsym == s.tsym) + public Type visitClassType(ClassType t, Symbol sym) { + if (t.tsym == sym) return t; Type st = supertype(t); - - switch(st.getTag()) { - default: break; - case CLASS: - case ARRAY: - case TYPEVAR: - case ERROR: { - Type x = asSuper(st, s); + if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) { + Type x = asSuper(st, sym); if (x != null) return x; - } break; } - - if ((s.tsym.flags() & INTERFACE) != 0) { + if ((sym.flags() & INTERFACE) != 0) { for (List l = interfaces(t); l.nonEmpty(); l = l.tail) { - Type x = asSuper(l.head, s); + Type x = asSuper(l.head, sym); if (x != null) return x; } @@ -1979,20 +1967,22 @@ } @Override - public Type visitArrayType(ArrayType t, Type s) { - return isSubtype(t, s) ? s : null; + public Type visitArrayType(ArrayType t, Symbol sym) { + return isSubtype(t, sym.type) ? sym.type : null; } @Override - public Type visitTypeVar(TypeVar t, Type s) { - if (t.tsym == s.tsym) + public Type visitTypeVar(TypeVar t, Symbol sym) { + if (t.tsym == sym) return t; else - return asSuper(t.bound, s); + return asSuper(t.bound, sym); } @Override - public Type visitErrorType(ErrorType t, Type s) { return t; } + public Type visitErrorType(ErrorType t, Symbol sym) { + return t; + } }; /** @@ -3573,9 +3563,9 @@ //step 3 - for each element G in MEC, compute lci(Inv(G)) List candidates = List.nil(); for (Type erasedSupertype : mec) { - List lci = List.of(asSuper(ts.head, erasedSupertype)); + List lci = List.of(asSuper(ts.head, erasedSupertype.tsym)); for (Type t : ts) { - lci = intersect(lci, List.of(asSuper(t, erasedSupertype))); + lci = intersect(lci, List.of(asSuper(t, erasedSupertype.tsym))); } candidates = candidates.appendList(lci); } @@ -3995,7 +3985,7 @@ // The arguments to the supers could be unified here to // get a more accurate analysis while (commonSupers.nonEmpty()) { - Type t1 = asSuper(from, commonSupers.head); + Type t1 = asSuper(from, commonSupers.head.tsym); Type t2 = commonSupers.head; // same as asSuper(to, commonSupers.head.tsym); if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments())) return false; @@ -4026,7 +4016,7 @@ from = target; } Assert.check((from.tsym.flags() & FINAL) != 0); - Type t1 = asSuper(from, to); + Type t1 = asSuper(from, to.tsym); if (t1 == null) return false; Type t2 = to; if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))