# HG changeset patch # User mcimadamore # Date 1348847813 -3600 # Node ID 1a65d6565b4502036e7c942d456d64ea54f44baa # Parent db36841709e475650b50c98e9ffc2d1b5df63a21 8000233: Fix issues in recent push Summary: Forgot to incorporate review comments in pushed changesets Reviewed-by: jjg diff -r db36841709e4 -r 1a65d6565b45 src/share/classes/com/sun/tools/javac/code/Type.java --- a/src/share/classes/com/sun/tools/javac/code/Type.java Wed Sep 26 14:22:41 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Fri Sep 28 16:56:53 2012 +0100 @@ -27,18 +27,19 @@ import java.util.Collections; +import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.util.*; -import com.sun.tools.javac.code.Symbol.*; import java.util.EnumMap; import java.util.EnumSet; import java.util.Map; import java.util.Set; + import javax.lang.model.type.*; +import static com.sun.tools.javac.code.BoundKind.*; import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.*; -import static com.sun.tools.javac.code.BoundKind.*; import static com.sun.tools.javac.code.TypeTags.*; /** This class represents Java types. The class itself defines the behavior of diff -r db36841709e4 -r 1a65d6565b45 src/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Sep 26 14:22:41 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Sep 28 16:56:53 2012 +0100 @@ -27,8 +27,8 @@ import com.sun.tools.javac.api.Formattable.LocalizedString; import com.sun.tools.javac.code.*; +import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type.*; -import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.comp.Attr.ResultInfo; import com.sun.tools.javac.comp.Check.CheckContext; import com.sun.tools.javac.comp.Infer.InferenceContext; @@ -48,6 +48,7 @@ import java.util.EnumMap; import java.util.EnumSet; import java.util.HashSet; +import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -60,7 +61,6 @@ import static com.sun.tools.javac.code.TypeTags.*; import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*; import static com.sun.tools.javac.tree.JCTree.Tag.*; -import java.util.Iterator; /** Helper class for name resolution, used mostly by the attribution phase. * @@ -1200,7 +1200,10 @@ for (TypeSymbol s : superclasses(intype)) { bestSoFar = lookupMethod(env, site, name, argtypes, typeargtypes, s.members(), bestSoFar, allowBoxing, useVarargs, operator, true); - abstractOk &= excludeAbstractsFilter.accepts(s); + //We should not look for abstract methods if receiver is a concrete class + //(as concrete classes are expected to implement all abstracts coming + //from superinterfaces) + abstractOk &= (s.flags() & (ABSTRACT | INTERFACE | ENUM)) != 0; if (abstractOk) { for (Type itype : types.interfaces(s.type)) { itypes = types.union(types.closure(itype), itypes); @@ -1247,36 +1250,41 @@ return new Iterator() { List seen = List.nil(); - TypeSymbol currentSym = getSymbol(intype); + TypeSymbol currentSym = symbolFor(intype); + TypeSymbol prevSym = null; public boolean hasNext() { + if (currentSym == syms.noSymbol) { + currentSym = symbolFor(types.supertype(prevSym.type)); + } return currentSym != null; } public TypeSymbol next() { - TypeSymbol prevSym = currentSym; - currentSym = getSymbol(types.supertype(currentSym.type)); + prevSym = currentSym; + currentSym = syms.noSymbol; + Assert.check(prevSym != null || prevSym != syms.noSymbol); return prevSym; } public void remove() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(); } - TypeSymbol getSymbol(Type intype) { - if (intype.tag != CLASS && - intype.tag != TYPEVAR) { + TypeSymbol symbolFor(Type t) { + if (t.tag != CLASS && + t.tag != TYPEVAR) { return null; } - while (intype.tag == TYPEVAR) - intype = intype.getUpperBound(); - if (seen.contains(intype.tsym)) { + while (t.tag == TYPEVAR) + t = t.getUpperBound(); + if (seen.contains(t.tsym)) { //degenerate case in which we have a circular //class hierarchy - because of ill-formed classfiles return null; } - seen = seen.prepend(intype.tsym); - return intype.tsym; + seen = seen.prepend(t.tsym); + return t.tsym; } }; } @@ -1284,17 +1292,6 @@ } /** - * We should not look for abstract methods if receiver is a concrete class - * (as concrete classes are expected to implement all abstracts coming - * from superinterfaces) - */ - Filter excludeAbstractsFilter = new Filter() { - public boolean accepts(Symbol s) { - return (s.flags() & (ABSTRACT | INTERFACE | ENUM)) != 0; - } - }; - - /** * Lookup a method with given name and argument types in a given scope */ Symbol lookupMethod(Env env, diff -r db36841709e4 -r 1a65d6565b45 src/share/classes/com/sun/tools/javac/jvm/Pool.java --- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java Wed Sep 26 14:22:41 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java Fri Sep 28 16:56:53 2012 +0100 @@ -27,17 +27,17 @@ import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Kinds; -import java.util.*; - import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type; -import com.sun.tools.javac.util.ArrayUtils; + import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.Filter; import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Names; +import java.util.*; + /** An internal structure that corresponds to the constant pool of a classfile. * *

This is NOT part of any supported API. @@ -177,13 +177,9 @@ /** Reference symbol */ Symbol refSym; - /** Reference to the name table */ - Names names; - - public MethodHandle(int refKind, Symbol refSym, Names names) { + public MethodHandle(int refKind, Symbol refSym) { this.refKind = refKind; this.refSym = refSym; - this.names = names; checkConsistent(); } public boolean equals(Object other) { @@ -244,13 +240,13 @@ //where Filter nonInitFilter = new Filter() { public boolean accepts(Name n) { - return n != names.init && n != names.clinit; + return n != n.table.names.init && n != n.table.names.clinit; } }; Filter initFilter = new Filter() { public boolean accepts(Name n) { - return n == names.init; + return n == n.table.names.init; } }; } diff -r db36841709e4 -r 1a65d6565b45 src/share/classes/com/sun/tools/javac/util/Names.java --- a/src/share/classes/com/sun/tools/javac/util/Names.java Wed Sep 26 14:22:41 2012 +0100 +++ b/src/share/classes/com/sun/tools/javac/util/Names.java Fri Sep 28 16:56:53 2012 +0100 @@ -118,6 +118,7 @@ // attribute names public final Name Annotation; public final Name AnnotationDefault; + public final Name BootstrapMethods; public final Name Bridge; public final Name CharacterRangeTable; public final Name Code; @@ -169,9 +170,6 @@ public final Name ex; public final Name package_info; - // lambda-related - public final Name BootstrapMethods; - public final Name.Table table; public Names(Context context) { @@ -249,6 +247,7 @@ // attribute names Annotation = fromString("Annotation"); AnnotationDefault = fromString("AnnotationDefault"); + BootstrapMethods = fromString("BootstrapMethods"); Bridge = fromString("Bridge"); CharacterRangeTable = fromString("CharacterRangeTable"); Code = fromString("Code"); @@ -299,9 +298,6 @@ deprecated = fromString("deprecated"); ex = fromString("ex"); package_info = fromString("package-info"); - - //lambda-related - BootstrapMethods = fromString("BootstrapMethods"); } protected Name.Table createTable(Options options) {