Tue, 16 Sep 2008 18:35:18 -0700
6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
Reviewed-by: darcy, mcimadamore
1.1 --- a/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java Fri Sep 12 23:32:51 2008 -0700 1.2 +++ b/src/share/classes/com/sun/tools/apt/mirror/AptEnv.java Tue Sep 16 18:35:18 2008 -0700 1.3 @@ -33,7 +33,7 @@ 1.4 import com.sun.tools.javac.comp.Attr; 1.5 import com.sun.tools.javac.comp.Enter; 1.6 import com.sun.tools.javac.util.Context; 1.7 -import com.sun.tools.javac.util.Name; 1.8 +import com.sun.tools.javac.util.Names; 1.9 1.10 1.11 /** 1.12 @@ -42,7 +42,7 @@ 1.13 1.14 public class AptEnv { 1.15 1.16 - public Name.Table names; // javac's name table 1.17 + public Names names; // javac's name table 1.18 public Symtab symtab; // javac's predefined symbols 1.19 public Types jctypes; // javac's type utilities 1.20 public Enter enter; // javac's enter phase 1.21 @@ -66,7 +66,7 @@ 1.22 private AptEnv(Context context) { 1.23 context.put(aptEnvKey, this); 1.24 1.25 - names = Name.Table.instance(context); 1.26 + names = Names.instance(context); 1.27 symtab = Symtab.instance(context); 1.28 jctypes = Types.instance(context); 1.29 enter = Enter.instance(context);
2.1 --- a/src/share/classes/com/sun/tools/javac/code/Attribute.java Fri Sep 12 23:32:51 2008 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Attribute.java Tue Sep 16 18:35:18 2008 -0700 2.3 @@ -166,7 +166,7 @@ 2.4 first = false; 2.5 2.6 Name name = value.fst.name; 2.7 - if (len > 1 || name != name.table.value) { 2.8 + if (len > 1 || name != name.table.names.value) { 2.9 buf.append(name); 2.10 buf.append('='); 2.11 }
3.1 --- a/src/share/classes/com/sun/tools/javac/code/Scope.java Fri Sep 12 23:32:51 2008 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Scope.java Tue Sep 16 18:35:18 2008 -0700 3.3 @@ -145,7 +145,7 @@ 3.4 assert shared == 0; 3.5 if (table != next.table) return next; 3.6 while (elems != null) { 3.7 - int hash = elems.sym.name.index & hashMask; 3.8 + int hash = elems.sym.name.hashCode() & hashMask; 3.9 Entry e = table[hash]; 3.10 assert e == elems : elems.sym; 3.11 table[hash] = elems.shadowed; 3.12 @@ -180,7 +180,7 @@ 3.13 private void copy(Entry e) { 3.14 if (e.sym != null) { 3.15 copy(e.shadowed); 3.16 - int hash = e.sym.name.index & hashMask; 3.17 + int hash = e.sym.name.hashCode() & hashMask; 3.18 e.shadowed = table[hash]; 3.19 table[hash] = e; 3.20 } 3.21 @@ -206,7 +206,7 @@ 3.22 assert shared == 0; 3.23 // Temporarily disabled (bug 6460352): 3.24 // if (nelems * 3 >= hashMask * 2) dble(); 3.25 - int hash = sym.name.index & hashMask; 3.26 + int hash = sym.name.hashCode() & hashMask; 3.27 Entry e = makeEntry(sym, table[hash], elems, s, origin); 3.28 table[hash] = e; 3.29 elems = e; 3.30 @@ -227,9 +227,9 @@ 3.31 if (e.scope == null) return; 3.32 3.33 // remove e from table and shadowed list; 3.34 - Entry te = table[sym.name.index & hashMask]; 3.35 + Entry te = table[sym.name.hashCode() & hashMask]; 3.36 if (te == e) 3.37 - table[sym.name.index & hashMask] = e.shadowed; 3.38 + table[sym.name.hashCode() & hashMask] = e.shadowed; 3.39 else while (true) { 3.40 if (te.shadowed == e) { 3.41 te.shadowed = e.shadowed; 3.42 @@ -279,7 +279,7 @@ 3.43 * for regular entries. 3.44 */ 3.45 public Entry lookup(Name name) { 3.46 - Entry e = table[name.index & hashMask]; 3.47 + Entry e = table[name.hashCode() & hashMask]; 3.48 while (e.scope != null && e.sym.name != name) 3.49 e = e.shadowed; 3.50 return e; 3.51 @@ -400,7 +400,7 @@ 3.52 } 3.53 3.54 public Entry lookup(Name name) { 3.55 - Entry e = table[name.index & hashMask]; 3.56 + Entry e = table[name.hashCode() & hashMask]; 3.57 while (e.scope != null && 3.58 (e.sym.name != name || 3.59 /* Since an inner class will show up in package and
4.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Sep 12 23:32:51 2008 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue Sep 16 18:35:18 2008 -0700 4.3 @@ -146,14 +146,14 @@ 4.4 * the default package; otherwise, the owner symbol is returned 4.5 */ 4.6 public Symbol location() { 4.7 - if (owner.name == null || (owner.name.len == 0 && owner.kind != PCK)) { 4.8 + if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK)) { 4.9 return null; 4.10 } 4.11 return owner; 4.12 } 4.13 4.14 public Symbol location(Type site, Types types) { 4.15 - if (owner.name == null || owner.name.len == 0) { 4.16 + if (owner.name == null || owner.name.isEmpty()) { 4.17 return location(); 4.18 } 4.19 if (owner.type.tag == CLASS) { 4.20 @@ -177,7 +177,7 @@ 4.21 */ 4.22 public Type externalType(Types types) { 4.23 Type t = erasure(types); 4.24 - if (name == name.table.init && owner.hasOuterInstance()) { 4.25 + if (name == name.table.names.init && owner.hasOuterInstance()) { 4.26 Type outerThisType = types.erasure(owner.type.getEnclosingType()); 4.27 return new MethodType(t.getParameterTypes().prepend(outerThisType), 4.28 t.getReturnType(), 4.29 @@ -212,7 +212,7 @@ 4.30 /** Is this symbol a constructor? 4.31 */ 4.32 public boolean isConstructor() { 4.33 - return name == name.table.init; 4.34 + return name == name.table.names.init; 4.35 } 4.36 4.37 /** The fully qualified name of this symbol. 4.38 @@ -501,7 +501,7 @@ 4.39 || (owner.kind == TYP && owner.type.tag == TYPEVAR) 4.40 )) return name; 4.41 Name prefix = owner.getQualifiedName(); 4.42 - if (prefix == null || prefix == prefix.table.empty) 4.43 + if (prefix == null || prefix == prefix.table.names.empty) 4.44 return name; 4.45 else return prefix.append('.', name); 4.46 } 4.47 @@ -516,7 +516,7 @@ 4.48 ) return name; 4.49 char sep = owner.kind == TYP ? '$' : '.'; 4.50 Name prefix = owner.flatName(); 4.51 - if (prefix == null || prefix == prefix.table.empty) 4.52 + if (prefix == null || prefix == prefix.table.names.empty) 4.53 return name; 4.54 else return prefix.append(sep, name); 4.55 } 4.56 @@ -737,7 +737,7 @@ 4.57 } 4.58 4.59 public String className() { 4.60 - if (name.len == 0) 4.61 + if (name.isEmpty()) 4.62 return 4.63 Log.getLocalizedString("anonymous.class", flatname); 4.64 else 4.65 @@ -1011,7 +1011,7 @@ 4.66 if ((flags() & BLOCK) != 0) { 4.67 return owner.name.toString(); 4.68 } else { 4.69 - String s = (name == name.table.init) 4.70 + String s = (name == name.table.names.init) 4.71 ? owner.name.toString() 4.72 : name.toString(); 4.73 if (type != null) { 4.74 @@ -1208,9 +1208,9 @@ 4.75 } 4.76 4.77 public ElementKind getKind() { 4.78 - if (name == name.table.init) 4.79 + if (name == name.table.names.init) 4.80 return ElementKind.CONSTRUCTOR; 4.81 - else if (name == name.table.clinit) 4.82 + else if (name == name.table.names.clinit) 4.83 return ElementKind.STATIC_INIT; 4.84 else 4.85 return ElementKind.METHOD;
5.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java Fri Sep 12 23:32:51 2008 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java Tue Sep 16 18:35:18 2008 -0700 5.3 @@ -73,7 +73,7 @@ 5.4 public final Type botType = new BottomType(); 5.5 public final JCNoType voidType = new JCNoType(TypeTags.VOID); 5.6 5.7 - private final Name.Table names; 5.8 + private final Names names; 5.9 private final ClassReader reader; 5.10 private final Target target; 5.11 5.12 @@ -328,7 +328,7 @@ 5.13 protected Symtab(Context context) throws CompletionFailure { 5.14 context.put(symtabKey, this); 5.15 5.16 - names = Name.Table.instance(context); 5.17 + names = Names.instance(context); 5.18 target = Target.instance(context); 5.19 5.20 // Create the unknown type
6.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Fri Sep 12 23:32:51 2008 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Tue Sep 16 18:35:18 2008 -0700 6.3 @@ -599,14 +599,14 @@ 6.4 } 6.5 //where 6.6 private String className(Symbol sym, boolean longform) { 6.7 - if (sym.name.len == 0 && (sym.flags() & COMPOUND) != 0) { 6.8 + if (sym.name.isEmpty() && (sym.flags() & COMPOUND) != 0) { 6.9 StringBuffer s = new StringBuffer(supertype_field.toString()); 6.10 for (List<Type> is=interfaces_field; is.nonEmpty(); is = is.tail) { 6.11 s.append("&"); 6.12 s.append(is.head.toString()); 6.13 } 6.14 return s.toString(); 6.15 - } else if (sym.name.len == 0) { 6.16 + } else if (sym.name.isEmpty()) { 6.17 String s; 6.18 ClassType norm = (ClassType) tsym.type; 6.19 if (norm == null) {
7.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Fri Sep 12 23:32:51 2008 -0700 7.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Tue Sep 16 18:35:18 2008 -0700 7.3 @@ -67,7 +67,7 @@ 7.4 new Context.Key<Types>(); 7.5 7.6 final Symtab syms; 7.7 - final Name.Table names; 7.8 + final Names names; 7.9 final boolean allowBoxing; 7.10 final ClassReader reader; 7.11 final Source source; 7.12 @@ -86,7 +86,7 @@ 7.13 protected Types(Context context) { 7.14 context.put(typesKey, this); 7.15 syms = Symtab.instance(context); 7.16 - names = Name.Table.instance(context); 7.17 + names = Names.instance(context); 7.18 allowBoxing = Source.instance(context).allowBoxing(); 7.19 reader = ClassReader.instance(context); 7.20 source = Source.instance(context); 7.21 @@ -2213,7 +2213,7 @@ 7.22 ClassType cls = (ClassType)t; 7.23 if (cls.rank_field < 0) { 7.24 Name fullname = cls.tsym.getQualifiedName(); 7.25 - if (fullname == fullname.table.java_lang_Object) 7.26 + if (fullname == names.java_lang_Object) 7.27 cls.rank_field = 0; 7.28 else { 7.29 int r = rank(supertype(cls));
8.1 --- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java Fri Sep 12 23:32:51 2008 -0700 8.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java Tue Sep 16 18:35:18 2008 -0700 8.3 @@ -55,7 +55,7 @@ 8.4 final TreeMaker make; 8.5 final Log log; 8.6 final Symtab syms; 8.7 - final Name.Table names; 8.8 + final Names names; 8.9 final Resolve rs; 8.10 final Types types; 8.11 final ConstFold cfolder; 8.12 @@ -67,7 +67,7 @@ 8.13 make = TreeMaker.instance(context); 8.14 log = Log.instance(context); 8.15 syms = Symtab.instance(context); 8.16 - names = Name.Table.instance(context); 8.17 + names = Names.instance(context); 8.18 rs = Resolve.instance(context); 8.19 types = Types.instance(context); 8.20 cfolder = ConstFold.instance(context);
9.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Sep 12 23:32:51 2008 -0700 9.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Sep 16 18:35:18 2008 -0700 9.3 @@ -68,7 +68,7 @@ 9.4 protected static final Context.Key<Attr> attrKey = 9.5 new Context.Key<Attr>(); 9.6 9.7 - final Name.Table names; 9.8 + final Names names; 9.9 final Log log; 9.10 final Symtab syms; 9.11 final Resolve rs; 9.12 @@ -92,7 +92,7 @@ 9.13 protected Attr(Context context) { 9.14 context.put(attrKey, this); 9.15 9.16 - names = Name.Table.instance(context); 9.17 + names = Names.instance(context); 9.18 log = Log.instance(context); 9.19 syms = Symtab.instance(context); 9.20 rs = Resolve.instance(context);
10.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Sep 12 23:32:51 2008 -0700 10.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Sep 16 18:35:18 2008 -0700 10.3 @@ -56,7 +56,7 @@ 10.4 protected static final Context.Key<Check> checkKey = 10.5 new Context.Key<Check>(); 10.6 10.7 - private final Name.Table names; 10.8 + private final Names names; 10.9 private final Log log; 10.10 private final Symtab syms; 10.11 private final Infer infer; 10.12 @@ -82,7 +82,7 @@ 10.13 protected Check(Context context) { 10.14 context.put(checkKey, this); 10.15 10.16 - names = Name.Table.instance(context); 10.17 + names = Names.instance(context); 10.18 log = Log.instance(context); 10.19 syms = Symtab.instance(context); 10.20 infer = Infer.instance(context); 10.21 @@ -628,7 +628,7 @@ 10.22 case TYP: 10.23 if (sym.isLocal()) { 10.24 mask = LocalClassFlags; 10.25 - if (sym.name.len == 0) { // Anonymous class 10.26 + if (sym.name.isEmpty()) { // Anonymous class 10.27 // Anonymous classes in static methods are themselves static; 10.28 // that's why we admit STATIC here. 10.29 mask |= STATIC;
11.1 --- a/src/share/classes/com/sun/tools/javac/comp/Enter.java Fri Sep 12 23:32:51 2008 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Enter.java Tue Sep 16 18:35:18 2008 -0700 11.3 @@ -333,7 +333,7 @@ 11.4 "class.public.should.be.in.file", tree.name); 11.5 } 11.6 } else { 11.7 - if (tree.name.len != 0 && 11.8 + if (!tree.name.isEmpty() && 11.9 !chk.checkUniqueClassName(tree.pos(), tree.name, enclScope)) { 11.10 result = null; 11.11 return; 11.12 @@ -348,7 +348,7 @@ 11.13 // We are seeing a local class. 11.14 c = reader.defineClass(tree.name, owner); 11.15 c.flatname = chk.localClassName(c); 11.16 - if (c.name.len != 0) 11.17 + if (!c.name.isEmpty()) 11.18 chk.checkTransparentClass(tree.pos(), c, env.info.scope); 11.19 } 11.20 }
12.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Sep 12 23:32:51 2008 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Sep 16 18:35:18 2008 -0700 12.3 @@ -177,7 +177,7 @@ 12.4 protected static final Context.Key<Flow> flowKey = 12.5 new Context.Key<Flow>(); 12.6 12.7 - private final Name.Table names; 12.8 + private final Names names; 12.9 private final Log log; 12.10 private final Symtab syms; 12.11 private final Types types; 12.12 @@ -195,7 +195,7 @@ 12.13 protected Flow(Context context) { 12.14 context.put(flowKey, this); 12.15 12.16 - names = Name.Table.instance(context); 12.17 + names = Names.instance(context); 12.18 log = Log.instance(context); 12.19 syms = Symtab.instance(context); 12.20 types = Types.instance(context);
13.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Fri Sep 12 23:32:51 2008 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Sep 16 18:35:18 2008 -0700 13.3 @@ -64,7 +64,7 @@ 13.4 return instance; 13.5 } 13.6 13.7 - private Name.Table names; 13.8 + private Names names; 13.9 private Log log; 13.10 private Symtab syms; 13.11 private Resolve rs; 13.12 @@ -85,7 +85,7 @@ 13.13 13.14 protected Lower(Context context) { 13.15 context.put(lowerKey, this); 13.16 - names = Name.Table.instance(context); 13.17 + names = Names.instance(context); 13.18 log = Log.instance(context); 13.19 syms = Symtab.instance(context); 13.20 rs = Resolve.instance(context); 13.21 @@ -1830,7 +1830,7 @@ 13.22 } 13.23 VarSymbol var = 13.24 new VarSymbol(FINAL|SYNTHETIC, 13.25 - Name.fromString(names, 13.26 + names.fromString( 13.27 target.syntheticNameChar() 13.28 + "" + rval.hashCode()), 13.29 type, 13.30 @@ -3338,7 +3338,7 @@ 13.31 ListBuffer<JCStatement> blockStatements = new ListBuffer<JCStatement>(); 13.32 13.33 JCModifiers mod1 = make.Modifiers(0L); 13.34 - Name oName = Name.fromString(names, "o"); 13.35 + Name oName = names.fromString("o"); 13.36 JCVariableDecl par1 = make.Param(oName, cdef.type, compareToSym); 13.37 13.38 JCIdent paramId1 = make.Ident(names.java_lang_Object); 13.39 @@ -3352,7 +3352,7 @@ 13.40 JCTypeCast cast = make.TypeCast(castTargetIdent, par1UsageId); 13.41 cast.setType(castTargetIdent.type); 13.42 13.43 - Name otherName = Name.fromString(names, "other"); 13.44 + Name otherName = names.fromString("other"); 13.45 13.46 VarSymbol otherVarSym = new VarSymbol(mod1.flags, 13.47 otherName,
14.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Fri Sep 12 23:32:51 2008 -0700 14.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Sep 16 18:35:18 2008 -0700 14.3 @@ -61,7 +61,7 @@ 14.4 */ 14.5 final static boolean checkClash = true; 14.6 14.7 - private final Name.Table names; 14.8 + private final Names names; 14.9 private final Enter enter; 14.10 private final Log log; 14.11 private final Check chk; 14.12 @@ -86,7 +86,7 @@ 14.13 14.14 protected MemberEnter(Context context) { 14.15 context.put(memberEnterKey, this); 14.16 - names = Name.Table.instance(context); 14.17 + names = Names.instance(context); 14.18 enter = Enter.instance(context); 14.19 log = Log.instance(context); 14.20 chk = Check.instance(context); 14.21 @@ -919,7 +919,7 @@ 14.22 List<Type> thrown = List.nil(); 14.23 long ctorFlags = 0; 14.24 boolean based = false; 14.25 - if (c.name.len == 0) { 14.26 + if (c.name.isEmpty()) { 14.27 JCNewClass nc = (JCNewClass)env.next.tree; 14.28 if (nc.constructor != null) { 14.29 Type superConstrType = types.memberType(c.type, 14.30 @@ -1068,7 +1068,7 @@ 14.31 flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR; 14.32 } else 14.33 flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR; 14.34 - if (c.name.len == 0) flags |= ANONCONSTR; 14.35 + if (c.name.isEmpty()) flags |= ANONCONSTR; 14.36 JCTree result = make.MethodDef( 14.37 make.Modifiers(flags), 14.38 names.init,
15.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Sep 12 23:32:51 2008 -0700 15.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Sep 16 18:35:18 2008 -0700 15.3 @@ -51,7 +51,7 @@ 15.4 protected static final Context.Key<Resolve> resolveKey = 15.5 new Context.Key<Resolve>(); 15.6 15.7 - Name.Table names; 15.8 + Names names; 15.9 Log log; 15.10 Symtab syms; 15.11 Check chk; 15.12 @@ -86,7 +86,7 @@ 15.13 typeNotFound = new 15.14 ResolveError(ABSENT_TYP, syms.errSymbol, "type not found"); 15.15 15.16 - names = Name.Table.instance(context); 15.17 + names = Names.instance(context); 15.18 log = Log.instance(context); 15.19 chk = Check.instance(context); 15.20 infer = Infer.instance(context); 15.21 @@ -1538,7 +1538,7 @@ 15.22 argtypes = List.nil(); 15.23 if (typeargtypes == null) 15.24 typeargtypes = List.nil(); 15.25 - if (name != name.table.error) { 15.26 + if (name != names.error) { 15.27 KindName kindname = absentKind(kind); 15.28 Name idname = name; 15.29 if (kind >= WRONG_MTHS && kind <= ABSENT_MTH) { 15.30 @@ -1547,7 +1547,7 @@ 15.31 name, argtypes); 15.32 return; 15.33 } 15.34 - if (name == name.table.init) { 15.35 + if (name == names.init) { 15.36 kindname = KindName.CONSTRUCTOR; 15.37 idname = site.tsym.name; 15.38 } 15.39 @@ -1563,7 +1563,7 @@ 15.40 kindName(ws.owner), 15.41 ws.owner.type, 15.42 explanation); 15.43 - } else if (site.tsym.name.len != 0) { 15.44 + } else if (!site.tsym.name.isEmpty()) { 15.45 if (site.tsym.kind == PCK && !site.tsym.exists()) 15.46 log.error(pos, "doesnt.exist", site.tsym); 15.47 else { 15.48 @@ -1601,9 +1601,9 @@ 15.49 */ 15.50 boolean isOperator(Name name) { 15.51 int i = 0; 15.52 - while (i < name.len && 15.53 - "+-~!*/%&|^<>=".indexOf(name.byteAt(i)) >= 0) i++; 15.54 - return i > 0 && i == name.len; 15.55 + while (i < name.getByteLength() && 15.56 + "+-~!*/%&|^<>=".indexOf(name.getByteAt(i)) >= 0) i++; 15.57 + return i > 0 && i == name.getByteLength(); 15.58 } 15.59 } 15.60 15.61 @@ -1639,7 +1639,7 @@ 15.62 void report(Log log, DiagnosticPosition pos, Type site, Name name, 15.63 List<Type> argtypes, List<Type> typeargtypes) { 15.64 if (sym.owner.type.tag != ERROR) { 15.65 - if (sym.name == sym.name.table.init && sym.owner != site.tsym) 15.66 + if (sym.name == names.init && sym.owner != site.tsym) 15.67 new ResolveError(ABSENT_MTH, sym.owner, "absent method " + sym).report( 15.68 log, pos, site, name, argtypes, typeargtypes); 15.69 if ((sym.flags() & PUBLIC) != 0 15.70 @@ -1723,7 +1723,7 @@ 15.71 else break; 15.72 } 15.73 Name sname = pair.sym1.name; 15.74 - if (sname == sname.table.init) sname = pair.sym1.owner.name; 15.75 + if (sname == names.init) sname = pair.sym1.owner.name; 15.76 log.error(pos, "ref.ambiguous", sname, 15.77 kindName(pair.sym1), 15.78 pair.sym1,
16.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Sep 12 23:32:51 2008 -0700 16.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Sep 16 18:35:18 2008 -0700 16.3 @@ -59,7 +59,7 @@ 16.4 return instance; 16.5 } 16.6 16.7 - private Name.Table names; 16.8 + private Names names; 16.9 private Log log; 16.10 private Symtab syms; 16.11 private TreeMaker make; 16.12 @@ -77,7 +77,7 @@ 16.13 16.14 protected TransTypes(Context context) { 16.15 context.put(transTypesKey, this); 16.16 - names = Name.Table.instance(context); 16.17 + names = Names.instance(context); 16.18 log = Log.instance(context); 16.19 syms = Symtab.instance(context); 16.20 enter = Enter.instance(context);
17.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java Fri Sep 12 23:32:51 2008 -0700 17.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java Tue Sep 16 18:35:18 2008 -0700 17.3 @@ -108,7 +108,7 @@ 17.4 * converting '/' to '.'. 17.5 */ 17.6 public static byte[] internalize(Name name) { 17.7 - return internalize(name.table.names, name.index, name.len); 17.8 + return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); 17.9 } 17.10 17.11 /** Return external representation of buf[offset..offset+len-1], 17.12 @@ -128,7 +128,7 @@ 17.13 * converting '/' to '.'. 17.14 */ 17.15 public static byte[] externalize(Name name) { 17.16 - return externalize(name.table.names, name.index, name.len); 17.17 + return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); 17.18 } 17.19 17.20 /************************************************************************
18.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Sep 12 23:32:51 2008 -0700 18.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Tue Sep 16 18:35:18 2008 -0700 18.3 @@ -122,7 +122,7 @@ 18.4 Types types; 18.5 18.6 /** The name table. */ 18.7 - final Name.Table names; 18.8 + final Names names; 18.9 18.10 /** Force a completion failure on this name 18.11 */ 18.12 @@ -220,7 +220,7 @@ 18.13 protected ClassReader(Context context, boolean definitive) { 18.14 if (definitive) context.put(classReaderKey, this); 18.15 18.16 - names = Name.Table.instance(context); 18.17 + names = Names.instance(context); 18.18 syms = Symtab.instance(context); 18.19 types = Types.instance(context); 18.20 fileManager = context.get(JavaFileManager.class); 18.21 @@ -516,14 +516,6 @@ 18.22 int siglimit; 18.23 boolean sigEnterPhase = false; 18.24 18.25 - /** Convert signature to type, where signature is a name. 18.26 - */ 18.27 - Type sigToType(Name sig) { 18.28 - return sig == null 18.29 - ? null 18.30 - : sigToType(sig.table.names, sig.index, sig.len); 18.31 - } 18.32 - 18.33 /** Convert signature to type, where signature is a byte array segment. 18.34 */ 18.35 Type sigToType(byte[] sig, int offset, int len) { 18.36 @@ -741,12 +733,6 @@ 18.37 return head.tail; 18.38 } 18.39 18.40 - /** Convert signature to type parameters, where signature is a name. 18.41 - */ 18.42 - List<Type> sigToTypeParams(Name name) { 18.43 - return sigToTypeParams(name.table.names, name.index, name.len); 18.44 - } 18.45 - 18.46 /** Convert signature to type parameters, where signature is a byte 18.47 * array segment. 18.48 */ 18.49 @@ -952,7 +938,7 @@ 18.50 18.51 self.name = simpleBinaryName(self.flatname, c.flatname) ; 18.52 self.owner = m != null ? m : c; 18.53 - if (self.name.len == 0) 18.54 + if (self.name.isEmpty()) 18.55 self.fullname = null; 18.56 else 18.57 self.fullname = ClassSymbol.formFullName(self.name, self.owner); 18.58 @@ -1500,7 +1486,7 @@ 18.59 // Sometimes anonymous classes don't have an outer 18.60 // instance, however, there is no reliable way to tell so 18.61 // we never strip this$n 18.62 - if (currentOwner.name.len != 0) 18.63 + if (!currentOwner.name.isEmpty()) 18.64 type = new MethodType(type.getParameterTypes().tail, 18.65 type.getReturnType(), 18.66 type.getThrownTypes(),
19.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Sep 12 23:32:51 2008 -0700 19.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Tue Sep 16 18:35:18 2008 -0700 19.3 @@ -26,7 +26,6 @@ 19.4 package com.sun.tools.javac.jvm; 19.5 19.6 import java.io.*; 19.7 -import java.util.*; 19.8 import java.util.Set; 19.9 import java.util.HashSet; 19.10 19.11 @@ -140,7 +139,7 @@ 19.12 private final Log log; 19.13 19.14 /** The name table. */ 19.15 - private final Name.Table names; 19.16 + private final Names names; 19.17 19.18 /** Access to files. */ 19.19 private final JavaFileManager fileManager; 19.20 @@ -166,7 +165,7 @@ 19.21 context.put(classWriterKey, this); 19.22 19.23 log = Log.instance(context); 19.24 - names = Name.Table.instance(context); 19.25 + names = Names.instance(context); 19.26 syms = Symtab.instance(context); 19.27 options = Options.instance(context); 19.28 target = Target.instance(context); 19.29 @@ -375,9 +374,7 @@ 19.30 sigbuf.appendByte('.'); 19.31 assert c.flatname.startsWith(c.owner.enclClass().flatname); 19.32 sigbuf.appendName(rawOuter 19.33 - ? c.flatname.subName(c.owner.enclClass() 19.34 - .flatname.len+1, 19.35 - c.flatname.len) 19.36 + ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength()) 19.37 : c.name); 19.38 } else { 19.39 sigbuf.appendBytes(externalize(c.flatname)); 19.40 @@ -542,7 +539,7 @@ 19.41 Name fieldName(Symbol sym) { 19.42 if (scramble && (sym.flags() & PRIVATE) != 0 || 19.43 scrambleAll && (sym.flags() & (PROTECTED | PUBLIC)) == 0) 19.44 - return names.fromString("_$" + sym.name.index); 19.45 + return names.fromString("_$" + sym.name.getIndex()); 19.46 else 19.47 return sym.name; 19.48 } 19.49 @@ -917,7 +914,7 @@ 19.50 databuf.appendChar( 19.51 inner.owner.kind == TYP ? pool.get(inner.owner) : 0); 19.52 databuf.appendChar( 19.53 - inner.name.len != 0 ? pool.get(inner.name) : 0); 19.54 + !inner.name.isEmpty() ? pool.get(inner.name) : 0); 19.55 databuf.appendChar(flags); 19.56 } 19.57 endAttr(alenIdx); 19.58 @@ -1457,7 +1454,7 @@ 19.59 try { 19.60 writeClassFile(out, c); 19.61 if (verbose) 19.62 - log.errWriter.println(log.getLocalizedString("verbose.wrote.file", outFile)); 19.63 + log.errWriter.println(Log.getLocalizedString("verbose.wrote.file", outFile)); 19.64 out.close(); 19.65 out = null; 19.66 } finally {
20.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java Fri Sep 12 23:32:51 2008 -0700 20.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java Tue Sep 16 18:35:18 2008 -0700 20.3 @@ -52,16 +52,16 @@ 20.4 public enum StackMapFormat { 20.5 NONE, 20.6 CLDC { 20.7 - Name getAttributeName(Name.Table names) { 20.8 + Name getAttributeName(Names names) { 20.9 return names.StackMap; 20.10 } 20.11 }, 20.12 JSR202 { 20.13 - Name getAttributeName(Name.Table names) { 20.14 + Name getAttributeName(Names names) { 20.15 return names.StackMapTable; 20.16 } 20.17 }; 20.18 - Name getAttributeName(Name.Table names) { 20.19 + Name getAttributeName(Names names) { 20.20 return names.empty; 20.21 } 20.22 }
21.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Sep 12 23:32:51 2008 -0700 21.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue Sep 16 18:35:18 2008 -0700 21.3 @@ -61,7 +61,7 @@ 21.4 private final Check chk; 21.5 private final Resolve rs; 21.6 private final TreeMaker make; 21.7 - private final Name.Table names; 21.8 + private final Names names; 21.9 private final Target target; 21.10 private final Type stringBufferType; 21.11 private final Map<Type,Symbol> stringBufferAppend; 21.12 @@ -92,7 +92,7 @@ 21.13 protected Gen(Context context) { 21.14 context.put(genKey, this); 21.15 21.16 - names = Name.Table.instance(context); 21.17 + names = Names.instance(context); 21.18 log = Log.instance(context); 21.19 syms = Symtab.instance(context); 21.20 chk = Check.instance(context); 21.21 @@ -365,7 +365,7 @@ 21.22 private boolean isOddAccessName(Name name) { 21.23 return 21.24 name.startsWith(accessDollar) && 21.25 - (name.byteAt(name.len - 1) & 1) == 1; 21.26 + (name.getByteAt(name.getByteLength() - 1) & 1) == 1; 21.27 } 21.28 21.29 /* ************************************************************************
22.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Sep 12 23:32:51 2008 -0700 22.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Sep 16 18:35:18 2008 -0700 22.3 @@ -236,7 +236,7 @@ 22.4 22.5 /** The name table. 22.6 */ 22.7 - protected Name.Table names; 22.8 + protected Names names; 22.9 22.10 /** The attributor. 22.11 */ 22.12 @@ -310,7 +310,7 @@ 22.13 if (context.get(JavaFileManager.class) == null) 22.14 JavacFileManager.preRegister(context); 22.15 22.16 - names = Name.Table.instance(context); 22.17 + names = Names.instance(context); 22.18 log = Log.instance(context); 22.19 diagFactory = JCDiagnostic.Factory.instance(context); 22.20 reader = ClassReader.instance(context); 22.21 @@ -1411,7 +1411,7 @@ 22.22 close(true); 22.23 } 22.24 22.25 - private void close(boolean disposeNames) { 22.26 + public void close(boolean disposeNames) { 22.27 rootClasses = null; 22.28 reader = null; 22.29 make = null;
23.1 --- a/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Fri Sep 12 23:32:51 2008 -0700 23.2 +++ b/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Tue Sep 16 18:35:18 2008 -0700 23.3 @@ -181,7 +181,7 @@ 23.4 public void visitArray(Attribute.Array a) { 23.5 Name elemName = ((ArrayType) a.type).elemtype.tsym.name; 23.6 23.7 - if (elemName == elemName.table.java_lang_Class) { // Class[] 23.8 + if (elemName == elemName.table.names.java_lang_Class) { // Class[] 23.9 // Construct a proxy for a MirroredTypesException 23.10 List<TypeMirror> elems = List.nil(); 23.11 for (Attribute value : a.values) {
24.1 --- a/src/share/classes/com/sun/tools/javac/model/JavacElements.java Fri Sep 12 23:32:51 2008 -0700 24.2 +++ b/src/share/classes/com/sun/tools/javac/model/JavacElements.java Tue Sep 16 18:35:18 2008 -0700 24.3 @@ -39,15 +39,14 @@ 24.4 import com.sun.tools.javac.comp.AttrContext; 24.5 import com.sun.tools.javac.comp.Enter; 24.6 import com.sun.tools.javac.comp.Env; 24.7 -import com.sun.tools.javac.jvm.ClassReader; 24.8 import com.sun.tools.javac.main.JavaCompiler; 24.9 import com.sun.tools.javac.processing.PrintingProcessor; 24.10 import com.sun.tools.javac.tree.JCTree; 24.11 import com.sun.tools.javac.tree.JCTree.*; 24.12 import com.sun.tools.javac.tree.TreeInfo; 24.13 import com.sun.tools.javac.tree.TreeScanner; 24.14 +import com.sun.tools.javac.util.*; 24.15 import com.sun.tools.javac.util.Name; 24.16 -import com.sun.tools.javac.util.*; 24.17 24.18 import static javax.lang.model.util.ElementFilter.methodsIn; 24.19 24.20 @@ -63,10 +62,9 @@ 24.21 24.22 private JavaCompiler javaCompiler; 24.23 private Symtab syms; 24.24 - private Name.Table names; 24.25 + private Names names; 24.26 private Types types; 24.27 private Enter enter; 24.28 - private ClassReader reader; 24.29 24.30 private static final Context.Key<JavacElements> KEY = 24.31 new Context.Key<JavacElements>(); 24.32 @@ -96,10 +94,9 @@ 24.33 public void setContext(Context context) { 24.34 javaCompiler = JavaCompiler.instance(context); 24.35 syms = Symtab.instance(context); 24.36 - names = Name.Table.instance(context); 24.37 + names = Names.instance(context); 24.38 types = Types.instance(context); 24.39 enter = Enter.instance(context); 24.40 - reader = ClassReader.instance(context); 24.41 } 24.42 24.43 24.44 @@ -126,7 +123,7 @@ 24.45 Class<A> annoType) { 24.46 boolean inherited = annoType.isAnnotationPresent(Inherited.class); 24.47 A result = null; 24.48 - while (annotated.name != annotated.name.table.java_lang_Object) { 24.49 + while (annotated.name != annotated.name.table.names.java_lang_Object) { 24.50 result = getAnnotation((Symbol)annotated, annoType); 24.51 if (result != null || !inherited) 24.52 break; 24.53 @@ -568,7 +565,7 @@ 24.54 } 24.55 24.56 public Name getName(CharSequence cs) { 24.57 - return Name.fromString(names, cs.toString()); 24.58 + return names.fromString(cs.toString()); 24.59 } 24.60 24.61 /**
25.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Sep 12 23:32:51 2008 -0700 25.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Sep 16 18:35:18 2008 -0700 25.3 @@ -73,7 +73,7 @@ 25.4 private Source source; 25.5 25.6 /** The name table. */ 25.7 - private Name.Table names; 25.8 + private Names names; 25.9 25.10 /** Construct a parser from a given scanner, tree factory and log. 25.11 */ 25.12 @@ -549,7 +549,7 @@ 25.13 25.14 String strval(Name prefix) { 25.15 String s = S.stringVal(); 25.16 - return (prefix.len == 0) ? s : prefix + s; 25.17 + return prefix.isEmpty() ? s : prefix + s; 25.18 } 25.19 25.20 /** terms can be either expressions or types.
26.1 --- a/src/share/classes/com/sun/tools/javac/parser/Keywords.java Fri Sep 12 23:32:51 2008 -0700 26.2 +++ b/src/share/classes/com/sun/tools/javac/parser/Keywords.java Tue Sep 16 18:35:18 2008 -0700 26.3 @@ -28,6 +28,7 @@ 26.4 import com.sun.tools.javac.util.Context; 26.5 import com.sun.tools.javac.util.Log; 26.6 import com.sun.tools.javac.util.Name; 26.7 +import com.sun.tools.javac.util.Names; 26.8 26.9 import static com.sun.tools.javac.parser.Token.*; 26.10 26.11 @@ -51,12 +52,12 @@ 26.12 } 26.13 26.14 private final Log log; 26.15 - private final Name.Table names; 26.16 + private final Names names; 26.17 26.18 protected Keywords(Context context) { 26.19 context.put(keywordsKey, this); 26.20 log = Log.instance(context); 26.21 - names = Name.Table.instance(context); 26.22 + names = Names.instance(context); 26.23 26.24 for (Token t : Token.values()) { 26.25 if (t.name != null) 26.26 @@ -69,13 +70,13 @@ 26.27 for (int i = 0; i <= maxKey; i++) key[i] = IDENTIFIER; 26.28 for (Token t : Token.values()) { 26.29 if (t.name != null) 26.30 - key[tokenName[t.ordinal()].index] = t; 26.31 + key[tokenName[t.ordinal()].getIndex()] = t; 26.32 } 26.33 } 26.34 26.35 26.36 public Token key(Name name) { 26.37 - return (name.index > maxKey) ? IDENTIFIER : key[name.index]; 26.38 + return (name.getIndex() > maxKey) ? IDENTIFIER : key[name.getIndex()]; 26.39 } 26.40 26.41 /** 26.42 @@ -94,6 +95,6 @@ 26.43 private void enterKeyword(String s, Token token) { 26.44 Name n = names.fromString(s); 26.45 tokenName[token.ordinal()] = n; 26.46 - if (n.index > maxKey) maxKey = n.index; 26.47 + if (n.getIndex() > maxKey) maxKey = n.getIndex(); 26.48 } 26.49 }
27.1 --- a/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java Fri Sep 12 23:32:51 2008 -0700 27.2 +++ b/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java Tue Sep 16 18:35:18 2008 -0700 27.3 @@ -29,7 +29,7 @@ 27.4 import com.sun.tools.javac.tree.TreeMaker; 27.5 import com.sun.tools.javac.util.Context; 27.6 import com.sun.tools.javac.util.Log; 27.7 -import com.sun.tools.javac.util.Name; 27.8 +import com.sun.tools.javac.util.Names; 27.9 import com.sun.tools.javac.util.Options; 27.10 27.11 /** 27.12 @@ -52,7 +52,7 @@ 27.13 final Log log; 27.14 final Keywords keywords; 27.15 final Source source; 27.16 - final Name.Table names; 27.17 + final Names names; 27.18 final Options options; 27.19 final Scanner.Factory scannerFactory; 27.20 27.21 @@ -61,7 +61,7 @@ 27.22 context.put(parserFactoryKey, this); 27.23 this.F = TreeMaker.instance(context); 27.24 this.log = Log.instance(context); 27.25 - this.names = Name.Table.instance(context); 27.26 + this.names = Names.instance(context); 27.27 this.keywords = Keywords.instance(context); 27.28 this.source = Source.instance(context); 27.29 this.options = Options.instance(context);
28.1 --- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java Fri Sep 12 23:32:51 2008 -0700 28.2 +++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java Tue Sep 16 18:35:18 2008 -0700 28.3 @@ -62,7 +62,7 @@ 28.4 } 28.5 28.6 final Log log; 28.7 - final Name.Table names; 28.8 + final Names names; 28.9 final Source source; 28.10 final Keywords keywords; 28.11 28.12 @@ -70,7 +70,7 @@ 28.13 protected Factory(Context context) { 28.14 context.put(scannerFactoryKey, this); 28.15 this.log = Log.instance(context); 28.16 - this.names = Name.Table.instance(context); 28.17 + this.names = Names.instance(context); 28.18 this.source = Source.instance(context); 28.19 this.keywords = Keywords.instance(context); 28.20 } 28.21 @@ -155,7 +155,7 @@ 28.22 private final Log log; 28.23 28.24 /** The name table. */ 28.25 - private final Name.Table names; 28.26 + private final Names names; 28.27 28.28 /** The keyword table. */ 28.29 private final Keywords keywords;
29.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Fri Sep 12 23:32:51 2008 -0700 29.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Sep 16 18:35:18 2008 -0700 29.3 @@ -70,6 +70,7 @@ 29.4 import com.sun.tools.javac.util.ListBuffer; 29.5 import com.sun.tools.javac.util.Log; 29.6 import com.sun.tools.javac.util.Name; 29.7 +import com.sun.tools.javac.util.Names; 29.8 import com.sun.tools.javac.util.Options; 29.9 29.10 import static javax.tools.StandardLocation.*; 29.11 @@ -831,7 +832,7 @@ 29.12 topLevelClasses = List.nil(); 29.13 packageInfoFiles = List.nil(); 29.14 29.15 - compiler.close(); 29.16 + compiler.close(false); 29.17 currentContext = contextForNextRound(currentContext, true); 29.18 29.19 JavaFileManager fileManager = currentContext.get(JavaFileManager.class); 29.20 @@ -879,7 +880,7 @@ 29.21 } 29.22 runLastRound(xout, roundNumber, errorStatus, taskListener); 29.23 29.24 - compiler.close(); 29.25 + compiler.close(false); 29.26 currentContext = contextForNextRound(currentContext, true); 29.27 compiler = JavaCompiler.instance(currentContext); 29.28 filer.newRound(currentContext, true); 29.29 @@ -913,7 +914,7 @@ 29.30 } else if (procOnly) { 29.31 compiler.todo.clear(); 29.32 } else { // Final compilation 29.33 - compiler.close(); 29.34 + compiler.close(false); 29.35 currentContext = contextForNextRound(currentContext, true); 29.36 compiler = JavaCompiler.instance(currentContext); 29.37 29.38 @@ -987,7 +988,7 @@ 29.39 29.40 private ListBuffer<ClassSymbol> enterNewClassFiles(Context currentContext) { 29.41 ClassReader reader = ClassReader.instance(currentContext); 29.42 - Name.Table names = Name.Table.instance(currentContext); 29.43 + Names names = Names.instance(currentContext); 29.44 ListBuffer<ClassSymbol> list = new ListBuffer<ClassSymbol>(); 29.45 29.46 for (Map.Entry<String,JavaFileObject> entry : filer.getGeneratedClasses().entrySet()) { 29.47 @@ -1047,9 +1048,9 @@ 29.48 next.put(Log.outKey, out); 29.49 29.50 if (shareNames) { 29.51 - Name.Table names = Name.Table.instance(context); 29.52 + Names names = Names.instance(context); 29.53 assert names != null; 29.54 - next.put(Name.Table.namesKey, names); 29.55 + next.put(Names.namesKey, names); 29.56 } 29.57 29.58 DiagnosticListener dl = context.get(DiagnosticListener.class); 29.59 @@ -1067,9 +1068,9 @@ 29.60 ((JavacFileManager)jfm).setContext(next); 29.61 } 29.62 29.63 - Name.Table names = Name.Table.instance(context); 29.64 + Names names = Names.instance(context); 29.65 assert names != null; 29.66 - next.put(Name.Table.namesKey, names); 29.67 + next.put(Names.namesKey, names); 29.68 29.69 Keywords keywords = Keywords.instance(context); 29.70 assert(keywords != null);
30.1 --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Sep 12 23:32:51 2008 -0700 30.2 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Tue Sep 16 18:35:18 2008 -0700 30.3 @@ -336,7 +336,7 @@ 30.4 if (l.head.getTag() == JCTree.IMPORT) { 30.5 JCImport imp = (JCImport)l.head; 30.6 Name name = TreeInfo.name(imp.qualid); 30.7 - if (name == name.table.asterisk || 30.8 + if (name == name.table.names.asterisk || 30.9 cdef == null || 30.10 isUsed(TreeInfo.symbol(imp.qualid), cdef)) { 30.11 if (firstImport) { 30.12 @@ -439,14 +439,14 @@ 30.13 public void visitMethodDef(JCMethodDecl tree) { 30.14 try { 30.15 // when producing source output, omit anonymous constructors 30.16 - if (tree.name == tree.name.table.init && 30.17 + if (tree.name == tree.name.table.names.init && 30.18 enclClassName == null && 30.19 sourceOutput) return; 30.20 println(); align(); 30.21 printDocComment(tree); 30.22 printExpr(tree.mods); 30.23 printTypeParameters(tree.typarams); 30.24 - if (tree.name == tree.name.table.init) { 30.25 + if (tree.name == tree.name.table.names.init) { 30.26 print(enclClassName != null ? enclClassName : tree.name); 30.27 } else { 30.28 printExpr(tree.restype); 30.29 @@ -835,8 +835,8 @@ 30.30 Name enclClassNamePrev = enclClassName; 30.31 enclClassName = 30.32 tree.def.name != null ? tree.def.name : 30.33 - tree.type != null && tree.type.tsym.name != tree.type.tsym.name.table.empty ? tree.type.tsym.name : 30.34 - null; 30.35 + tree.type != null && tree.type.tsym.name != tree.type.tsym.name.table.names.empty 30.36 + ? tree.type.tsym.name : null; 30.37 if ((tree.def.mods.flags & Flags.ENUM) != 0) print("/*enum*/"); 30.38 printBlock(tree.def.defs); 30.39 enclClassName = enclClassNamePrev;
31.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Sep 12 23:32:51 2008 -0700 31.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Tue Sep 16 18:35:18 2008 -0700 31.3 @@ -61,7 +61,7 @@ 31.4 private TreeInfo(Context context) { 31.5 context.put(treeInfoKey, this); 31.6 31.7 - Name.Table names = Name.Table.instance(context); 31.8 + Names names = Names.instance(context); 31.9 opname[JCTree.POS - JCTree.POS] = names.fromString("+"); 31.10 opname[JCTree.NEG - JCTree.POS] = names.hyphen; 31.11 opname[JCTree.NOT - JCTree.POS] = names.fromString("!"); 31.12 @@ -104,7 +104,7 @@ 31.13 public static boolean isConstructor(JCTree tree) { 31.14 if (tree.getTag() == JCTree.METHODDEF) { 31.15 Name name = ((JCMethodDecl) tree).name; 31.16 - return name == name.table.init; 31.17 + return name == name.table.names.init; 31.18 } else { 31.19 return false; 31.20 } 31.21 @@ -130,7 +130,7 @@ 31.22 if (select.sym != null && 31.23 (select.sym.flags() & SYNTHETIC) != 0) { 31.24 Name selected = name(select.selected); 31.25 - if (selected != null && selected == selected.table._this) 31.26 + if (selected != null && selected == selected.table.names._this) 31.27 return true; 31.28 } 31.29 } 31.30 @@ -157,7 +157,7 @@ 31.31 public static boolean isSelfCall(JCTree tree) { 31.32 Name name = calledMethodName(tree); 31.33 if (name != null) { 31.34 - Name.Table names = name.table; 31.35 + Names names = name.table.names; 31.36 return name==names._this || name==names._super; 31.37 } else { 31.38 return false; 31.39 @@ -169,7 +169,7 @@ 31.40 public static boolean isSuperCall(JCTree tree) { 31.41 Name name = calledMethodName(tree); 31.42 if (name != null) { 31.43 - Name.Table names = name.table; 31.44 + Names names = name.table.names; 31.45 return name==names._super; 31.46 } else { 31.47 return false; 31.48 @@ -183,14 +183,14 @@ 31.49 JCMethodInvocation app = firstConstructorCall(tree); 31.50 if (app == null) return false; 31.51 Name meth = name(app.meth); 31.52 - return meth == null || meth != meth.table._this; 31.53 + return meth == null || meth != meth.table.names._this; 31.54 } 31.55 31.56 /** Return the first call in a constructor definition. */ 31.57 public static JCMethodInvocation firstConstructorCall(JCTree tree) { 31.58 if (tree.getTag() != JCTree.METHODDEF) return null; 31.59 JCMethodDecl md = (JCMethodDecl) tree; 31.60 - Name.Table names = md.name.table; 31.61 + Names names = md.name.table.names; 31.62 if (md.name != names.init) return null; 31.63 if (md.body == null) return null; 31.64 List<JCStatement> stats = md.body.stats;
32.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Fri Sep 12 23:32:51 2008 -0700 32.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Tue Sep 16 18:35:18 2008 -0700 32.3 @@ -67,7 +67,7 @@ 32.4 public JCCompilationUnit toplevel; 32.5 32.6 /** The current name table. */ 32.7 - Name.Table names; 32.8 + Names names; 32.9 32.10 Types types; 32.11 32.12 @@ -80,14 +80,14 @@ 32.13 context.put(treeMakerKey, this); 32.14 this.pos = Position.NOPOS; 32.15 this.toplevel = null; 32.16 - this.names = Name.Table.instance(context); 32.17 + this.names = Names.instance(context); 32.18 this.syms = Symtab.instance(context); 32.19 this.types = Types.instance(context); 32.20 } 32.21 32.22 /** Create a tree maker with a given toplevel and FIRSTPOS as initial position. 32.23 */ 32.24 - TreeMaker(JCCompilationUnit toplevel, Name.Table names, Types types, Symtab syms) { 32.25 + TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) { 32.26 this.pos = Position.FIRSTPOS; 32.27 this.toplevel = toplevel; 32.28 this.names = names;
33.1 --- a/src/share/classes/com/sun/tools/javac/util/ByteBuffer.java Fri Sep 12 23:32:51 2008 -0700 33.2 +++ b/src/share/classes/com/sun/tools/javac/util/ByteBuffer.java Tue Sep 16 18:35:18 2008 -0700 33.3 @@ -150,7 +150,7 @@ 33.4 /** Append a name. 33.5 */ 33.6 public void appendName(Name name) { 33.7 - appendBytes(name.table.names, name.index, name.len); 33.8 + appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength()); 33.9 } 33.10 33.11 /** Reset to zero length. 33.12 @@ -161,7 +161,7 @@ 33.13 33.14 /** Convert contents to name. 33.15 */ 33.16 - public Name toName(Name.Table names) { 33.17 + public Name toName(Names names) { 33.18 return names.fromUtf(elems, 0, length); 33.19 } 33.20 }
34.1 --- a/src/share/classes/com/sun/tools/javac/util/Convert.java Fri Sep 12 23:32:51 2008 -0700 34.2 +++ b/src/share/classes/com/sun/tools/javac/util/Convert.java Tue Sep 16 18:35:18 2008 -0700 34.3 @@ -289,7 +289,7 @@ 34.4 */ 34.5 public static Name shortName(Name classname) { 34.6 return classname.subName( 34.7 - classname.lastIndexOf((byte)'.') + 1, classname.len); 34.8 + classname.lastIndexOf((byte)'.') + 1, classname.getByteLength()); 34.9 } 34.10 34.11 public static String shortName(String classname) {
35.1 --- a/src/share/classes/com/sun/tools/javac/util/Name.java Fri Sep 12 23:32:51 2008 -0700 35.2 +++ b/src/share/classes/com/sun/tools/javac/util/Name.java Tue Sep 16 18:35:18 2008 -0700 35.3 @@ -25,246 +25,111 @@ 35.4 35.5 package com.sun.tools.javac.util; 35.6 35.7 -import java.lang.ref.SoftReference; 35.8 - 35.9 - 35.10 -/** An abstraction for internal compiler strings. For efficiency reasons, 35.11 - * GJC uses hashed strings that are stored in a common large buffer. 35.12 - * 35.13 - * <p>Names represent unique hashable strings. Two names are equal 35.14 - * if their indices are equal. Utf8 representation is used 35.15 - * for storing names internally. 35.16 +/** An abstraction for internal compiler strings. They are stored in 35.17 + * Utf8 format. Names are stored in a Name.Table, and are unique within 35.18 + * that table. 35.19 * 35.20 * <p><b>This is NOT part of any API supported by Sun Microsystems. If 35.21 * you write code that depends on this, you do so at your own risk. 35.22 * This code and its internal interfaces are subject to change or 35.23 * deletion without notice.</b> 35.24 */ 35.25 -public class Name implements javax.lang.model.element.Name { 35.26 +public abstract class Name implements javax.lang.model.element.Name { 35.27 35.28 - /** The table structure where the name is stored 35.29 - */ 35.30 - public Table table; 35.31 + public final Table table; 35.32 35.33 - /** The index where the bytes of this name are stored in the global name 35.34 - * buffer `names'. 35.35 - */ 35.36 - public int index; 35.37 - 35.38 - /** The number of bytes in this name. 35.39 - */ 35.40 - public int len; 35.41 - 35.42 - /** The next name occupying the same hash bucket. 35.43 - */ 35.44 - Name next; 35.45 - 35.46 - /** The hashcode of a name. 35.47 - */ 35.48 - private static int hashValue(byte cs[], int start, int len) { 35.49 - int h = 0; 35.50 - int off = start; 35.51 - 35.52 - for (int i = 0; i < len; i++) { 35.53 - h = (h << 5) - h + cs[off++]; 35.54 - } 35.55 - return h; 35.56 + protected Name(Table table) { 35.57 + this.table = table; 35.58 } 35.59 35.60 - /** Is (the utf8 representation of) name equal to 35.61 - * cs[start..start+len-1]? 35.62 + /** 35.63 + * @inheritDoc 35.64 */ 35.65 - private static boolean equals(byte[] names, int index, 35.66 - byte cs[], int start, int len) { 35.67 - int i = 0; 35.68 - while (i < len && names[index + i] == cs[start + i]) i++; 35.69 - return i == len; 35.70 + public boolean contentEquals(CharSequence cs) { 35.71 + return toString().equals(cs.toString()); 35.72 } 35.73 35.74 - /** Create a name from the bytes in cs[start..start+len-1]. 35.75 - * Assume that bytes are in utf8 format. 35.76 - */ 35.77 - public static Name fromUtf(Table table, byte cs[], int start, int len) { 35.78 - int h = hashValue(cs, start, len) & table.hashMask; 35.79 - Name n = table.hashes[h]; 35.80 - byte[] names = table.names; 35.81 - while (n != null && 35.82 - (n.len != len || !equals(names, n.index, cs, start, len))) 35.83 - n = n.next; 35.84 - if (n == null) { 35.85 - int nc = table.nc; 35.86 - while (nc + len > names.length) { 35.87 -// System.err.println("doubling name buffer of length + " + names.length + " to fit " + len + " bytes");//DEBUG 35.88 - byte[] newnames = new byte[names.length * 2]; 35.89 - System.arraycopy(names, 0, newnames, 0, names.length); 35.90 - names = table.names = newnames; 35.91 - } 35.92 - System.arraycopy(cs, start, names, nc, len); 35.93 - n = new Name(); 35.94 - n.table = table; 35.95 - n.index = nc; 35.96 - n.len = len; 35.97 - n.next = table.hashes[h]; 35.98 - table.hashes[h] = n; 35.99 - table.nc = nc + len; 35.100 - if (len == 0) table.nc++; 35.101 - } 35.102 - return n; 35.103 - } 35.104 - 35.105 - /** Create a name from the bytes in array cs. 35.106 - * Assume that bytes are in utf8 format. 35.107 - */ 35.108 - public static Name fromUtf(Table table, byte cs[]) { 35.109 - return fromUtf(table, cs, 0, cs.length); 35.110 - } 35.111 - 35.112 - /** Create a name from the characters in cs[start..start+len-1]. 35.113 - */ 35.114 - public static Name fromChars(Table table, char[] cs, int start, int len) { 35.115 - int nc = table.nc; 35.116 - byte[] names = table.names; 35.117 - while (nc + len * 3 >= names.length) { 35.118 -// System.err.println("doubling name buffer of length " + names.length + " to fit " + len + " chars");//DEBUG 35.119 - byte[] newnames = new byte[names.length * 2]; 35.120 - System.arraycopy(names, 0, newnames, 0, names.length); 35.121 - names = table.names = newnames; 35.122 - } 35.123 - int nbytes = 35.124 - Convert.chars2utf(cs, start, names, nc, len) - nc; 35.125 - int h = hashValue(names, nc, nbytes) & table.hashMask; 35.126 - Name n = table.hashes[h]; 35.127 - while (n != null && 35.128 - (n.len != nbytes || 35.129 - !equals(names, n.index, names, nc, nbytes))) 35.130 - n = n.next; 35.131 - if (n == null) { 35.132 - n = new Name(); 35.133 - n.table = table; 35.134 - n.index = nc; 35.135 - n.len = nbytes; 35.136 - n.next = table.hashes[h]; 35.137 - table.hashes[h] = n; 35.138 - table.nc = nc + nbytes; 35.139 - if (nbytes == 0) table.nc++; 35.140 - } 35.141 - return n; 35.142 - } 35.143 - 35.144 - /** Create a name from the characters in string s. 35.145 - */ 35.146 - public static Name fromString(Table table, String s) { 35.147 - char[] cs = s.toCharArray(); 35.148 - return fromChars(table, cs, 0, cs.length); 35.149 - } 35.150 - 35.151 - /** Create a name from the characters in char sequence s. 35.152 - */ 35.153 - public static Name fromString(Table table, CharSequence s) { 35.154 - return fromString(table, s.toString()); 35.155 - } 35.156 - 35.157 - /** Return the Utf8 representation of this name. 35.158 - */ 35.159 - public byte[] toUtf() { 35.160 - byte[] bs = new byte[len]; 35.161 - System.arraycopy(table.names, index, bs, 0, len); 35.162 - return bs; 35.163 - } 35.164 - 35.165 - /** Return the string representation of this name. 35.166 - */ 35.167 - public String toString() { 35.168 - return Convert.utf2string(table.names, index, len); 35.169 - } 35.170 - 35.171 - /** Copy all bytes of this name to buffer cs, starting at start. 35.172 - */ 35.173 - public void getBytes(byte cs[], int start) { 35.174 - System.arraycopy(table.names, index, cs, start, len); 35.175 - } 35.176 - 35.177 - /** Return the hash value of this name. 35.178 - */ 35.179 - public int hashCode() { 35.180 - return index; 35.181 - } 35.182 - 35.183 - /** Is this name equal to other? 35.184 - */ 35.185 - public boolean equals(Object other) { 35.186 - if (other instanceof Name) 35.187 - return 35.188 - table == ((Name)other).table && index == ((Name)other).index; 35.189 - else return false; 35.190 - } 35.191 - 35.192 - /** Compare this name to other name, yielding -1 if smaller, 0 if equal, 35.193 - * 1 if greater. 35.194 - */ 35.195 - public boolean less(Name that) { 35.196 - int i = 0; 35.197 - while (i < this.len && i < that.len) { 35.198 - byte thisb = this.table.names[this.index + i]; 35.199 - byte thatb = that.table.names[that.index + i]; 35.200 - if (thisb < thatb) return true; 35.201 - else if (thisb > thatb) return false; 35.202 - else i++; 35.203 - } 35.204 - return this.len < that.len; 35.205 - } 35.206 - 35.207 - /** Returns the length of this name. 35.208 + /** 35.209 + * @inheritDoc 35.210 */ 35.211 public int length() { 35.212 return toString().length(); 35.213 } 35.214 35.215 - /** Returns i'th byte of this name. 35.216 + /** 35.217 + * @inheritDoc 35.218 */ 35.219 - public byte byteAt(int i) { 35.220 - return table.names[index + i]; 35.221 + public char charAt(int index) { 35.222 + return toString().charAt(index); 35.223 } 35.224 35.225 - /** Returns first occurrence of byte b in this name, len if not found. 35.226 + /** 35.227 + * @inheritDoc 35.228 */ 35.229 - public int indexOf(byte b) { 35.230 - byte[] names = table.names; 35.231 - int i = 0; 35.232 - while (i < len && names[index + i] != b) i++; 35.233 - return i; 35.234 + public CharSequence subSequence(int start, int end) { 35.235 + return toString().subSequence(start, end); 35.236 + } 35.237 + 35.238 + /** Return the concatenation of this name and name `n'. 35.239 + */ 35.240 + public Name append(Name n) { 35.241 + int len = getByteLength(); 35.242 + byte[] bs = new byte[len + n.getByteLength()]; 35.243 + getBytes(bs, 0); 35.244 + n.getBytes(bs, len); 35.245 + return table.fromUtf(bs, 0, bs.length); 35.246 + } 35.247 + 35.248 + /** Return the concatenation of this name, the given ASCII 35.249 + * character, and name `n'. 35.250 + */ 35.251 + public Name append(char c, Name n) { 35.252 + int len = getByteLength(); 35.253 + byte[] bs = new byte[len + 1 + n.getByteLength()]; 35.254 + getBytes(bs, 0); 35.255 + bs[len] = (byte) c; 35.256 + n.getBytes(bs, len+1); 35.257 + return table.fromUtf(bs, 0, bs.length); 35.258 + } 35.259 + 35.260 + /** An arbitrary but consistent complete order among all Names. 35.261 + */ 35.262 + public int compareTo(Name other) { 35.263 + return other.getIndex() - this.getIndex(); 35.264 + } 35.265 + 35.266 + /** Return true if this is the empty name. 35.267 + */ 35.268 + public boolean isEmpty() { 35.269 + return getByteLength() == 0; 35.270 } 35.271 35.272 /** Returns last occurrence of byte b in this name, -1 if not found. 35.273 */ 35.274 public int lastIndexOf(byte b) { 35.275 - byte[] names = table.names; 35.276 - int i = len - 1; 35.277 - while (i >= 0 && names[index + i] != b) i--; 35.278 + byte[] bytes = getByteArray(); 35.279 + int offset = getByteOffset(); 35.280 + int i = getByteLength() - 1; 35.281 + while (i >= 0 && bytes[offset + i] != b) i--; 35.282 return i; 35.283 } 35.284 35.285 /** Does this name start with prefix? 35.286 */ 35.287 public boolean startsWith(Name prefix) { 35.288 + byte[] thisBytes = this.getByteArray(); 35.289 + int thisOffset = this.getByteOffset(); 35.290 + int thisLength = this.getByteLength(); 35.291 + byte[] prefixBytes = prefix.getByteArray(); 35.292 + int prefixOffset = prefix.getByteOffset(); 35.293 + int prefixLength = prefix.getByteLength(); 35.294 + 35.295 int i = 0; 35.296 - while (i < prefix.len && 35.297 - i < len && 35.298 - table.names[index + i] == prefix.table.names[prefix.index + i]) 35.299 + while (i < prefixLength && 35.300 + i < thisLength && 35.301 + thisBytes[thisOffset + i] == prefixBytes[prefixOffset + i]) 35.302 i++; 35.303 - return i == prefix.len; 35.304 - } 35.305 - 35.306 - /** Does this name end with suffix? 35.307 - */ 35.308 - public boolean endsWith(Name suffix) { 35.309 - int i = len - 1; 35.310 - int j = suffix.len - 1; 35.311 - while (j >= 0 && i >= 0 && 35.312 - table.names[index + i] == suffix.table.names[suffix.index + j]) { 35.313 - i--; j--; 35.314 - } 35.315 - return j < 0; 35.316 + return i == prefixLength; 35.317 } 35.318 35.319 /** Returns the sub-name starting at position start, up to and 35.320 @@ -272,382 +137,110 @@ 35.321 */ 35.322 public Name subName(int start, int end) { 35.323 if (end < start) end = start; 35.324 - return fromUtf(table, table.names, index + start, end - start); 35.325 + return table.fromUtf(getByteArray(), getByteOffset() + start, end - start); 35.326 } 35.327 35.328 - /** Replace all `from' bytes in this name with `to' bytes. 35.329 + /** Return the string representation of this name. 35.330 */ 35.331 - public Name replace(byte from, byte to) { 35.332 - byte[] names = table.names; 35.333 - int i = 0; 35.334 - while (i < len) { 35.335 - if (names[index + i] == from) { 35.336 - byte[] bs = new byte[len]; 35.337 - System.arraycopy(names, index, bs, 0, i); 35.338 - bs[i] = to; 35.339 - i++; 35.340 - while (i < len) { 35.341 - byte b = names[index + i]; 35.342 - bs[i] = b == from ? to : b; 35.343 - i++; 35.344 - } 35.345 - return fromUtf(table, bs, 0, len); 35.346 - } 35.347 - i++; 35.348 - } 35.349 - return this; 35.350 + public String toString() { 35.351 + return Convert.utf2string(getByteArray(), getByteOffset(), getByteLength()); 35.352 } 35.353 35.354 - /** Return the concatenation of this name and name `n'. 35.355 + /** Return the Utf8 representation of this name. 35.356 */ 35.357 - public Name append(Name n) { 35.358 - byte[] bs = new byte[len + n.len]; 35.359 + public byte[] toUtf() { 35.360 + byte[] bs = new byte[getByteLength()]; 35.361 getBytes(bs, 0); 35.362 - n.getBytes(bs, len); 35.363 - return fromUtf(table, bs, 0, bs.length); 35.364 + return bs; 35.365 } 35.366 35.367 - /** Return the concatenation of this name, the given ASCII 35.368 - * character, and name `n'. 35.369 + /* Get a "reasonably small" value that uniquely identifies this name 35.370 + * within its name table. 35.371 */ 35.372 - public Name append(char c, Name n) { 35.373 - byte[] bs = new byte[len + n.len + 1]; 35.374 - getBytes(bs, 0); 35.375 - bs[len] = (byte)c; 35.376 - n.getBytes(bs, len+1); 35.377 - return fromUtf(table, bs, 0, bs.length); 35.378 + public abstract int getIndex(); 35.379 + 35.380 + /** Get the length (in bytes) of this name. 35.381 + */ 35.382 + public abstract int getByteLength(); 35.383 + 35.384 + /** Returns i'th byte of this name. 35.385 + */ 35.386 + public abstract byte getByteAt(int i); 35.387 + 35.388 + /** Copy all bytes of this name to buffer cs, starting at start. 35.389 + */ 35.390 + public void getBytes(byte cs[], int start) { 35.391 + System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength()); 35.392 } 35.393 35.394 - /** An arbitrary but consistent complete order among all Names. 35.395 + /** Get the underlying byte array for this name. The contents of the 35.396 + * array must not be modified. 35.397 */ 35.398 - public int compareTo(Name other) { 35.399 - return other.index - this.index; 35.400 - } 35.401 + public abstract byte[] getByteArray(); 35.402 35.403 - /** Return the concatenation of all names in the array `ns'. 35.404 + /** Get the start offset of this name within its byte array. 35.405 */ 35.406 - public static Name concat(Table table, Name ns[]) { 35.407 - int len = 0; 35.408 - for (int i = 0; i < ns.length; i++) 35.409 - len = len + ns[i].len; 35.410 - byte[] bs = new byte[len]; 35.411 - len = 0; 35.412 - for (int i = 0; i < ns.length; i++) { 35.413 - ns[i].getBytes(bs, len); 35.414 - len = len + ns[i].len; 35.415 - } 35.416 - return fromUtf(table, bs, 0, len); 35.417 - } 35.418 + public abstract int getByteOffset(); 35.419 35.420 - public char charAt(int index) { 35.421 - return toString().charAt(index); 35.422 - } 35.423 + /** An abstraction for the hash table used to create unique Name instances. 35.424 + */ 35.425 + public static abstract class Table { 35.426 + /** Standard name table. 35.427 + */ 35.428 + public final Names names; 35.429 35.430 - public CharSequence subSequence(int start, int end) { 35.431 - return toString().subSequence(start, end); 35.432 - } 35.433 - 35.434 - public boolean contentEquals(CharSequence cs) { 35.435 - return this.toString().equals(cs.toString()); 35.436 - } 35.437 - 35.438 - public static class Table { 35.439 - // maintain a freelist of recently used name tables for reuse. 35.440 - private static List<SoftReference<Table>> freelist = List.nil(); 35.441 - 35.442 - static private synchronized Table make() { 35.443 - while (freelist.nonEmpty()) { 35.444 - Table t = freelist.head.get(); 35.445 - freelist = freelist.tail; 35.446 - if (t != null) return t; 35.447 - } 35.448 - return new Table(); 35.449 + Table(Names names) { 35.450 + this.names = names; 35.451 } 35.452 35.453 - static private synchronized void dispose(Table t) { 35.454 - freelist = freelist.prepend(new SoftReference<Table>(t)); 35.455 + /** Get the name from the characters in cs[start..start+len-1]. 35.456 + */ 35.457 + public abstract Name fromChars(char[] cs, int start, int len); 35.458 + 35.459 + /** Get the name for the characters in string s. 35.460 + */ 35.461 + public Name fromString(String s) { 35.462 + char[] cs = s.toCharArray(); 35.463 + return fromChars(cs, 0, cs.length); 35.464 } 35.465 35.466 - public void dispose() { 35.467 - dispose(this); 35.468 + /** Get the name for the bytes in array cs. 35.469 + * Assume that bytes are in utf8 format. 35.470 + */ 35.471 + public Name fromUtf(byte[] cs) { 35.472 + return fromUtf(cs, 0, cs.length); 35.473 } 35.474 35.475 - public static final Context.Key<Table> namesKey = 35.476 - new Context.Key<Table>(); 35.477 + /** get the name for the bytes in cs[start..start+len-1]. 35.478 + * Assume that bytes are in utf8 format. 35.479 + */ 35.480 + public abstract Name fromUtf(byte[] cs, int start, int len); 35.481 35.482 - public static Table instance(Context context) { 35.483 - Table instance = context.get(namesKey); 35.484 - if (instance == null) { 35.485 - instance = make(); 35.486 - context.put(namesKey, instance); 35.487 + /** Release any resources used by this table. 35.488 + */ 35.489 + public abstract void dispose(); 35.490 + 35.491 + /** The hashcode of a name. 35.492 + */ 35.493 + protected static int hashValue(byte bytes[], int offset, int length) { 35.494 + int h = 0; 35.495 + int off = offset; 35.496 + 35.497 + for (int i = 0; i < length; i++) { 35.498 + h = (h << 5) - h + bytes[off++]; 35.499 } 35.500 - return instance; 35.501 + return h; 35.502 } 35.503 35.504 - /** The hash table for names. 35.505 + /** Compare two subarrays 35.506 */ 35.507 - private Name[] hashes; 35.508 - 35.509 - /** The array holding all encountered names. 35.510 - */ 35.511 - public byte[] names; 35.512 - 35.513 - /** The mask to be used for hashing 35.514 - */ 35.515 - private int hashMask; 35.516 - 35.517 - /** The number of filled bytes in `names'. 35.518 - */ 35.519 - private int nc = 0; 35.520 - 35.521 - /** Allocator 35.522 - * @param hashSize the (constant) size to be used for the hash table 35.523 - * needs to be a power of two. 35.524 - * @param nameSize the initial size of the name table. 35.525 - */ 35.526 - public Table(int hashSize, int nameSize) { 35.527 - hashMask = hashSize - 1; 35.528 - hashes = new Name[hashSize]; 35.529 - names = new byte[nameSize]; 35.530 - 35.531 - slash = fromString("/"); 35.532 - hyphen = fromString("-"); 35.533 - T = fromString("T"); 35.534 - slashequals = fromString("/="); 35.535 - deprecated = fromString("deprecated"); 35.536 - 35.537 - init = fromString("<init>"); 35.538 - clinit = fromString("<clinit>"); 35.539 - error = fromString("<error>"); 35.540 - any = fromString("<any>"); 35.541 - empty = fromString(""); 35.542 - one = fromString("1"); 35.543 - period = fromString("."); 35.544 - comma = fromString(","); 35.545 - semicolon = fromString(";"); 35.546 - asterisk = fromString("*"); 35.547 - _this = fromString("this"); 35.548 - _super = fromString("super"); 35.549 - _default = fromString("default"); 35.550 - 35.551 - _class = fromString("class"); 35.552 - java_lang = fromString("java.lang"); 35.553 - java_lang_Object = fromString("java.lang.Object"); 35.554 - java_lang_Class = fromString("java.lang.Class"); 35.555 - java_lang_Cloneable = fromString("java.lang.Cloneable"); 35.556 - java_io_Serializable = fromString("java.io.Serializable"); 35.557 - java_lang_Enum = fromString("java.lang.Enum"); 35.558 - package_info = fromString("package-info"); 35.559 - serialVersionUID = fromString("serialVersionUID"); 35.560 - ConstantValue = fromString("ConstantValue"); 35.561 - LineNumberTable = fromString("LineNumberTable"); 35.562 - LocalVariableTable = fromString("LocalVariableTable"); 35.563 - LocalVariableTypeTable = fromString("LocalVariableTypeTable"); 35.564 - CharacterRangeTable = fromString("CharacterRangeTable"); 35.565 - StackMap = fromString("StackMap"); 35.566 - StackMapTable = fromString("StackMapTable"); 35.567 - SourceID = fromString("SourceID"); 35.568 - CompilationID = fromString("CompilationID"); 35.569 - Code = fromString("Code"); 35.570 - Exceptions = fromString("Exceptions"); 35.571 - SourceFile = fromString("SourceFile"); 35.572 - InnerClasses = fromString("InnerClasses"); 35.573 - Synthetic = fromString("Synthetic"); 35.574 - Bridge= fromString("Bridge"); 35.575 - Deprecated = fromString("Deprecated"); 35.576 - Enum = fromString("Enum"); 35.577 - _name = fromString("name"); 35.578 - Signature = fromString("Signature"); 35.579 - Varargs = fromString("Varargs"); 35.580 - Annotation = fromString("Annotation"); 35.581 - RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations"); 35.582 - RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations"); 35.583 - RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations"); 35.584 - RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations"); 35.585 - Value = fromString("Value"); 35.586 - EnclosingMethod = fromString("EnclosingMethod"); 35.587 - 35.588 - desiredAssertionStatus = fromString("desiredAssertionStatus"); 35.589 - 35.590 - append = fromString("append"); 35.591 - family = fromString("family"); 35.592 - forName = fromString("forName"); 35.593 - toString = fromString("toString"); 35.594 - length = fromString("length"); 35.595 - valueOf = fromString("valueOf"); 35.596 - value = fromString("value"); 35.597 - getMessage = fromString("getMessage"); 35.598 - getClass = fromString("getClass"); 35.599 - 35.600 - TYPE = fromString("TYPE"); 35.601 - FIELD = fromString("FIELD"); 35.602 - METHOD = fromString("METHOD"); 35.603 - PARAMETER = fromString("PARAMETER"); 35.604 - CONSTRUCTOR = fromString("CONSTRUCTOR"); 35.605 - LOCAL_VARIABLE = fromString("LOCAL_VARIABLE"); 35.606 - ANNOTATION_TYPE = fromString("ANNOTATION_TYPE"); 35.607 - PACKAGE = fromString("PACKAGE"); 35.608 - 35.609 - SOURCE = fromString("SOURCE"); 35.610 - CLASS = fromString("CLASS"); 35.611 - RUNTIME = fromString("RUNTIME"); 35.612 - 35.613 - Array = fromString("Array"); 35.614 - Method = fromString("Method"); 35.615 - Bound = fromString("Bound"); 35.616 - clone = fromString("clone"); 35.617 - getComponentType = fromString("getComponentType"); 35.618 - getClassLoader = fromString("getClassLoader"); 35.619 - initCause = fromString("initCause"); 35.620 - values = fromString("values"); 35.621 - iterator = fromString("iterator"); 35.622 - hasNext = fromString("hasNext"); 35.623 - next = fromString("next"); 35.624 - AnnotationDefault = fromString("AnnotationDefault"); 35.625 - ordinal = fromString("ordinal"); 35.626 - equals = fromString("equals"); 35.627 - hashCode = fromString("hashCode"); 35.628 - compareTo = fromString("compareTo"); 35.629 - getDeclaringClass = fromString("getDeclaringClass"); 35.630 - ex = fromString("ex"); 35.631 - finalize = fromString("finalize"); 35.632 + protected static boolean equals(byte[] bytes1, int offset1, 35.633 + byte[] bytes2, int offset2, int length) { 35.634 + int i = 0; 35.635 + while (i < length && bytes1[offset1 + i] == bytes2[offset2 + i]) { 35.636 + i++; 35.637 + } 35.638 + return i == length; 35.639 } 35.640 - 35.641 - public Table() { 35.642 - this(0x8000, 0x20000); 35.643 - } 35.644 - 35.645 - /** Create a name from the bytes in cs[start..start+len-1]. 35.646 - * Assume that bytes are in utf8 format. 35.647 - */ 35.648 - public Name fromUtf(byte cs[], int start, int len) { 35.649 - return Name.fromUtf(this, cs, start, len); 35.650 - } 35.651 - 35.652 - /** Create a name from the bytes in array cs. 35.653 - * Assume that bytes are in utf8 format. 35.654 - */ 35.655 - public Name fromUtf(byte cs[]) { 35.656 - return Name.fromUtf(this, cs, 0, cs.length); 35.657 - } 35.658 - 35.659 - /** Create a name from the characters in cs[start..start+len-1]. 35.660 - */ 35.661 - public Name fromChars(char[] cs, int start, int len) { 35.662 - return Name.fromChars(this, cs, start, len); 35.663 - } 35.664 - 35.665 - /** Create a name from the characters in string s. 35.666 - */ 35.667 - public Name fromString(CharSequence s) { 35.668 - return Name.fromString(this, s); 35.669 - } 35.670 - 35.671 - public final Name slash; 35.672 - public final Name hyphen; 35.673 - public final Name T; 35.674 - public final Name slashequals; 35.675 - public final Name deprecated; 35.676 - 35.677 - public final Name init; 35.678 - public final Name clinit; 35.679 - public final Name error; 35.680 - public final Name any; 35.681 - public final Name empty; 35.682 - public final Name one; 35.683 - public final Name period; 35.684 - public final Name comma; 35.685 - public final Name semicolon; 35.686 - public final Name asterisk; 35.687 - public final Name _this; 35.688 - public final Name _super; 35.689 - public final Name _default; 35.690 - 35.691 - public final Name _class; 35.692 - public final Name java_lang; 35.693 - public final Name java_lang_Object; 35.694 - public final Name java_lang_Class; 35.695 - public final Name java_lang_Cloneable; 35.696 - public final Name java_io_Serializable; 35.697 - public final Name serialVersionUID; 35.698 - public final Name java_lang_Enum; 35.699 - public final Name package_info; 35.700 - public final Name ConstantValue; 35.701 - public final Name LineNumberTable; 35.702 - public final Name LocalVariableTable; 35.703 - public final Name LocalVariableTypeTable; 35.704 - public final Name CharacterRangeTable; 35.705 - public final Name StackMap; 35.706 - public final Name StackMapTable; 35.707 - public final Name SourceID; 35.708 - public final Name CompilationID; 35.709 - public final Name Code; 35.710 - public final Name Exceptions; 35.711 - public final Name SourceFile; 35.712 - public final Name InnerClasses; 35.713 - public final Name Synthetic; 35.714 - public final Name Bridge; 35.715 - public final Name Deprecated; 35.716 - public final Name Enum; 35.717 - public final Name _name; 35.718 - public final Name Signature; 35.719 - public final Name Varargs; 35.720 - public final Name Annotation; 35.721 - public final Name RuntimeVisibleAnnotations; 35.722 - public final Name RuntimeInvisibleAnnotations; 35.723 - public final Name RuntimeVisibleParameterAnnotations; 35.724 - public final Name RuntimeInvisibleParameterAnnotations; 35.725 - 35.726 - public final Name Value; 35.727 - public final Name EnclosingMethod; 35.728 - 35.729 - public final Name desiredAssertionStatus; 35.730 - 35.731 - public final Name append; 35.732 - public final Name family; 35.733 - public final Name forName; 35.734 - public final Name toString; 35.735 - public final Name length; 35.736 - public final Name valueOf; 35.737 - public final Name value; 35.738 - public final Name getMessage; 35.739 - public final Name getClass; 35.740 - 35.741 - public final Name TYPE; 35.742 - public final Name FIELD; 35.743 - public final Name METHOD; 35.744 - public final Name PARAMETER; 35.745 - public final Name CONSTRUCTOR; 35.746 - public final Name LOCAL_VARIABLE; 35.747 - public final Name ANNOTATION_TYPE; 35.748 - public final Name PACKAGE; 35.749 - 35.750 - public final Name SOURCE; 35.751 - public final Name CLASS; 35.752 - public final Name RUNTIME; 35.753 - 35.754 - public final Name Array; 35.755 - public final Name Method; 35.756 - public final Name Bound; 35.757 - public final Name clone; 35.758 - public final Name getComponentType; 35.759 - public final Name getClassLoader; 35.760 - public final Name initCause; 35.761 - public final Name values; 35.762 - public final Name iterator; 35.763 - public final Name hasNext; 35.764 - public final Name next; 35.765 - public final Name AnnotationDefault; 35.766 - public final Name ordinal; 35.767 - public final Name equals; 35.768 - public final Name hashCode; 35.769 - public final Name compareTo; 35.770 - public final Name getDeclaringClass; 35.771 - public final Name ex; 35.772 - public final Name finalize; 35.773 - } 35.774 - 35.775 - public boolean isEmpty() { 35.776 - return len == 0; 35.777 } 35.778 }
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/src/share/classes/com/sun/tools/javac/util/Names.java Tue Sep 16 18:35:18 2008 -0700 36.3 @@ -0,0 +1,281 @@ 36.4 +/* 36.5 + * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. 36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.7 + * 36.8 + * This code is free software; you can redistribute it and/or modify it 36.9 + * under the terms of the GNU General Public License version 2 only, as 36.10 + * published by the Free Software Foundation. Sun designates this 36.11 + * particular file as subject to the "Classpath" exception as provided 36.12 + * by Sun in the LICENSE file that accompanied this code. 36.13 + * 36.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 36.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 36.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 36.17 + * version 2 for more details (a copy is included in the LICENSE file that 36.18 + * accompanied this code). 36.19 + * 36.20 + * You should have received a copy of the GNU General Public License version 36.21 + * 2 along with this work; if not, write to the Free Software Foundation, 36.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 36.23 + * 36.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 36.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 36.26 + * have any questions. 36.27 + */ 36.28 + 36.29 +package com.sun.tools.javac.util; 36.30 + 36.31 +/** 36.32 + * Access to the compiler's name table. STandard names are defined, 36.33 + * as well as methods to create new names. 36.34 + * 36.35 + * <p><b>This is NOT part of any API supported by Sun Microsystems. If 36.36 + * you write code that depends on this, you do so at your own risk. 36.37 + * This code and its internal interfaces are subject to change or 36.38 + * deletion without notice.</b> 36.39 + */ 36.40 +public class Names { 36.41 + 36.42 + public static final Context.Key<Names> namesKey = new Context.Key<Names>(); 36.43 + 36.44 + public static Names instance(Context context) { 36.45 + Names instance = context.get(namesKey); 36.46 + if (instance == null) { 36.47 + instance = new Names(context); 36.48 + context.put(namesKey, instance); 36.49 + } 36.50 + return instance; 36.51 + } 36.52 + 36.53 + public final Name slash; 36.54 + public final Name hyphen; 36.55 + public final Name T; 36.56 + public final Name slashequals; 36.57 + public final Name deprecated; 36.58 + public final Name init; 36.59 + public final Name clinit; 36.60 + public final Name error; 36.61 + public final Name any; 36.62 + public final Name empty; 36.63 + public final Name one; 36.64 + public final Name period; 36.65 + public final Name comma; 36.66 + public final Name semicolon; 36.67 + public final Name asterisk; 36.68 + public final Name _this; 36.69 + public final Name _super; 36.70 + public final Name _default; 36.71 + public final Name _class; 36.72 + public final Name java_lang; 36.73 + public final Name java_lang_Object; 36.74 + public final Name java_lang_Class; 36.75 + public final Name java_lang_Cloneable; 36.76 + public final Name java_io_Serializable; 36.77 + public final Name serialVersionUID; 36.78 + public final Name java_lang_Enum; 36.79 + public final Name package_info; 36.80 + public final Name ConstantValue; 36.81 + public final Name LineNumberTable; 36.82 + public final Name LocalVariableTable; 36.83 + public final Name LocalVariableTypeTable; 36.84 + public final Name CharacterRangeTable; 36.85 + public final Name StackMap; 36.86 + public final Name StackMapTable; 36.87 + public final Name SourceID; 36.88 + public final Name CompilationID; 36.89 + public final Name Code; 36.90 + public final Name Exceptions; 36.91 + public final Name SourceFile; 36.92 + public final Name InnerClasses; 36.93 + public final Name Synthetic; 36.94 + public final Name Bridge; 36.95 + public final Name Deprecated; 36.96 + public final Name Enum; 36.97 + public final Name _name; 36.98 + public final Name Signature; 36.99 + public final Name Varargs; 36.100 + public final Name Annotation; 36.101 + public final Name RuntimeVisibleAnnotations; 36.102 + public final Name RuntimeInvisibleAnnotations; 36.103 + public final Name RuntimeVisibleParameterAnnotations; 36.104 + public final Name RuntimeInvisibleParameterAnnotations; 36.105 + public final Name Value; 36.106 + public final Name EnclosingMethod; 36.107 + public final Name desiredAssertionStatus; 36.108 + public final Name append; 36.109 + public final Name family; 36.110 + public final Name forName; 36.111 + public final Name toString; 36.112 + public final Name length; 36.113 + public final Name valueOf; 36.114 + public final Name value; 36.115 + public final Name getMessage; 36.116 + public final Name getClass; 36.117 + public final Name TYPE; 36.118 + public final Name FIELD; 36.119 + public final Name METHOD; 36.120 + public final Name PARAMETER; 36.121 + public final Name CONSTRUCTOR; 36.122 + public final Name LOCAL_VARIABLE; 36.123 + public final Name ANNOTATION_TYPE; 36.124 + public final Name PACKAGE; 36.125 + public final Name SOURCE; 36.126 + public final Name CLASS; 36.127 + public final Name RUNTIME; 36.128 + public final Name Array; 36.129 + public final Name Method; 36.130 + public final Name Bound; 36.131 + public final Name clone; 36.132 + public final Name getComponentType; 36.133 + public final Name getClassLoader; 36.134 + public final Name initCause; 36.135 + public final Name values; 36.136 + public final Name iterator; 36.137 + public final Name hasNext; 36.138 + public final Name next; 36.139 + public final Name AnnotationDefault; 36.140 + public final Name ordinal; 36.141 + public final Name equals; 36.142 + public final Name hashCode; 36.143 + public final Name compareTo; 36.144 + public final Name getDeclaringClass; 36.145 + public final Name ex; 36.146 + public final Name finalize; 36.147 + 36.148 + public final Name.Table table; 36.149 + 36.150 + public Names(Context context) { 36.151 + Options options = Options.instance(context); 36.152 + table = createTable(options); 36.153 + 36.154 + slash = fromString("/"); 36.155 + hyphen = fromString("-"); 36.156 + T = fromString("T"); 36.157 + slashequals = fromString("/="); 36.158 + deprecated = fromString("deprecated"); 36.159 + 36.160 + init = fromString("<init>"); 36.161 + clinit = fromString("<clinit>"); 36.162 + error = fromString("<error>"); 36.163 + any = fromString("<any>"); 36.164 + empty = fromString(""); 36.165 + one = fromString("1"); 36.166 + period = fromString("."); 36.167 + comma = fromString(","); 36.168 + semicolon = fromString(";"); 36.169 + asterisk = fromString("*"); 36.170 + _this = fromString("this"); 36.171 + _super = fromString("super"); 36.172 + _default = fromString("default"); 36.173 + 36.174 + _class = fromString("class"); 36.175 + java_lang = fromString("java.lang"); 36.176 + java_lang_Object = fromString("java.lang.Object"); 36.177 + java_lang_Class = fromString("java.lang.Class"); 36.178 + java_lang_Cloneable = fromString("java.lang.Cloneable"); 36.179 + java_io_Serializable = fromString("java.io.Serializable"); 36.180 + java_lang_Enum = fromString("java.lang.Enum"); 36.181 + package_info = fromString("package-info"); 36.182 + serialVersionUID = fromString("serialVersionUID"); 36.183 + ConstantValue = fromString("ConstantValue"); 36.184 + LineNumberTable = fromString("LineNumberTable"); 36.185 + LocalVariableTable = fromString("LocalVariableTable"); 36.186 + LocalVariableTypeTable = fromString("LocalVariableTypeTable"); 36.187 + CharacterRangeTable = fromString("CharacterRangeTable"); 36.188 + StackMap = fromString("StackMap"); 36.189 + StackMapTable = fromString("StackMapTable"); 36.190 + SourceID = fromString("SourceID"); 36.191 + CompilationID = fromString("CompilationID"); 36.192 + Code = fromString("Code"); 36.193 + Exceptions = fromString("Exceptions"); 36.194 + SourceFile = fromString("SourceFile"); 36.195 + InnerClasses = fromString("InnerClasses"); 36.196 + Synthetic = fromString("Synthetic"); 36.197 + Bridge = fromString("Bridge"); 36.198 + Deprecated = fromString("Deprecated"); 36.199 + Enum = fromString("Enum"); 36.200 + _name = fromString("name"); 36.201 + Signature = fromString("Signature"); 36.202 + Varargs = fromString("Varargs"); 36.203 + Annotation = fromString("Annotation"); 36.204 + RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations"); 36.205 + RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations"); 36.206 + RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations"); 36.207 + RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations"); 36.208 + Value = fromString("Value"); 36.209 + EnclosingMethod = fromString("EnclosingMethod"); 36.210 + 36.211 + desiredAssertionStatus = fromString("desiredAssertionStatus"); 36.212 + 36.213 + append = fromString("append"); 36.214 + family = fromString("family"); 36.215 + forName = fromString("forName"); 36.216 + toString = fromString("toString"); 36.217 + length = fromString("length"); 36.218 + valueOf = fromString("valueOf"); 36.219 + value = fromString("value"); 36.220 + getMessage = fromString("getMessage"); 36.221 + getClass = fromString("getClass"); 36.222 + 36.223 + TYPE = fromString("TYPE"); 36.224 + FIELD = fromString("FIELD"); 36.225 + METHOD = fromString("METHOD"); 36.226 + PARAMETER = fromString("PARAMETER"); 36.227 + CONSTRUCTOR = fromString("CONSTRUCTOR"); 36.228 + LOCAL_VARIABLE = fromString("LOCAL_VARIABLE"); 36.229 + ANNOTATION_TYPE = fromString("ANNOTATION_TYPE"); 36.230 + PACKAGE = fromString("PACKAGE"); 36.231 + 36.232 + SOURCE = fromString("SOURCE"); 36.233 + CLASS = fromString("CLASS"); 36.234 + RUNTIME = fromString("RUNTIME"); 36.235 + 36.236 + Array = fromString("Array"); 36.237 + Method = fromString("Method"); 36.238 + Bound = fromString("Bound"); 36.239 + clone = fromString("clone"); 36.240 + getComponentType = fromString("getComponentType"); 36.241 + getClassLoader = fromString("getClassLoader"); 36.242 + initCause = fromString("initCause"); 36.243 + values = fromString("values"); 36.244 + iterator = fromString("iterator"); 36.245 + hasNext = fromString("hasNext"); 36.246 + next = fromString("next"); 36.247 + AnnotationDefault = fromString("AnnotationDefault"); 36.248 + ordinal = fromString("ordinal"); 36.249 + equals = fromString("equals"); 36.250 + hashCode = fromString("hashCode"); 36.251 + compareTo = fromString("compareTo"); 36.252 + getDeclaringClass = fromString("getDeclaringClass"); 36.253 + ex = fromString("ex"); 36.254 + finalize = fromString("finalize"); 36.255 + } 36.256 + 36.257 + protected Name.Table createTable(Options options) { 36.258 + boolean useUnsharedTable = options.get("useUnsharedTable") != null; 36.259 + if (useUnsharedTable) 36.260 + return new UnsharedNameTable(this); 36.261 + else 36.262 + return new SharedNameTable(this); 36.263 + } 36.264 + 36.265 + public void dispose() { 36.266 + table.dispose(); 36.267 + } 36.268 + 36.269 + public Name fromChars(char[] cs, int start, int len) { 36.270 + return table.fromChars(cs, start, len); 36.271 + } 36.272 + 36.273 + public Name fromString(String s) { 36.274 + return table.fromString(s); 36.275 + } 36.276 + 36.277 + public Name fromUtf(byte[] cs) { 36.278 + return table.fromUtf(cs); 36.279 + } 36.280 + 36.281 + public Name fromUtf(byte[] cs, int start, int len) { 36.282 + return table.fromUtf(cs, start, len); 36.283 + } 36.284 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java Tue Sep 16 18:35:18 2008 -0700 37.3 @@ -0,0 +1,221 @@ 37.4 +/* 37.5 + * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. 37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.7 + * 37.8 + * This code is free software; you can redistribute it and/or modify it 37.9 + * under the terms of the GNU General Public License version 2 only, as 37.10 + * published by the Free Software Foundation. Sun designates this 37.11 + * particular file as subject to the "Classpath" exception as provided 37.12 + * by Sun in the LICENSE file that accompanied this code. 37.13 + * 37.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 37.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 37.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 37.17 + * version 2 for more details (a copy is included in the LICENSE file that 37.18 + * accompanied this code). 37.19 + * 37.20 + * You should have received a copy of the GNU General Public License version 37.21 + * 2 along with this work; if not, write to the Free Software Foundation, 37.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 37.23 + * 37.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 37.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 37.26 + * have any questions. 37.27 + */ 37.28 + 37.29 +package com.sun.tools.javac.util; 37.30 + 37.31 +import java.lang.ref.SoftReference; 37.32 + 37.33 +/** 37.34 + * Implementation of Name.Table that stores all names in a single shared 37.35 + * byte array, expanding it as needed. This avoids the overhead incurred 37.36 + * by using an array of bytes for each name. 37.37 + * 37.38 + * <p><b>This is NOT part of any API supported by Sun Microsystems. If 37.39 + * you write code that depends on this, you do so at your own risk. 37.40 + * This code and its internal interfaces are subject to change or 37.41 + * deletion without notice.</b> 37.42 + */ 37.43 +public class SharedNameTable extends Name.Table { 37.44 + // maintain a freelist of recently used name tables for reuse. 37.45 + private static List<SoftReference<SharedNameTable>> freelist = List.nil(); 37.46 + 37.47 + static public synchronized SharedNameTable create(Names names) { 37.48 + while (freelist.nonEmpty()) { 37.49 + SharedNameTable t = freelist.head.get(); 37.50 + freelist = freelist.tail; 37.51 + if (t != null) { 37.52 + return t; 37.53 + } 37.54 + } 37.55 + return new SharedNameTable(names); 37.56 + } 37.57 + 37.58 + static private synchronized void dispose(SharedNameTable t) { 37.59 + freelist = freelist.prepend(new SoftReference<SharedNameTable>(t)); 37.60 + } 37.61 + 37.62 + /** The hash table for names. 37.63 + */ 37.64 + private NameImpl[] hashes; 37.65 + 37.66 + /** The shared byte array holding all encountered names. 37.67 + */ 37.68 + public byte[] bytes; 37.69 + 37.70 + /** The mask to be used for hashing 37.71 + */ 37.72 + private int hashMask; 37.73 + 37.74 + /** The number of filled bytes in `names'. 37.75 + */ 37.76 + private int nc = 0; 37.77 + 37.78 + /** Allocator 37.79 + * @param names The main name table 37.80 + * @param hashSize the (constant) size to be used for the hash table 37.81 + * needs to be a power of two. 37.82 + * @param nameSize the initial size of the name table. 37.83 + */ 37.84 + public SharedNameTable(Names names, int hashSize, int nameSize) { 37.85 + super(names); 37.86 + hashMask = hashSize - 1; 37.87 + hashes = new NameImpl[hashSize]; 37.88 + bytes = new byte[nameSize]; 37.89 + 37.90 + } 37.91 + 37.92 + public SharedNameTable(Names names) { 37.93 + this(names, 0x8000, 0x20000); 37.94 + } 37.95 + 37.96 + @Override 37.97 + public Name fromChars(char[] cs, int start, int len) { 37.98 + int nc = this.nc; 37.99 + byte[] bytes = this.bytes; 37.100 + while (nc + len * 3 >= bytes.length) { 37.101 + // System.err.println("doubling name buffer of length " + names.length + " to fit " + len + " chars");//DEBUG 37.102 + byte[] newnames = new byte[bytes.length * 2]; 37.103 + System.arraycopy(bytes, 0, newnames, 0, bytes.length); 37.104 + bytes = this.bytes = newnames; 37.105 + } 37.106 + int nbytes = Convert.chars2utf(cs, start, bytes, nc, len) - nc; 37.107 + int h = hashValue(bytes, nc, nbytes) & hashMask; 37.108 + NameImpl n = hashes[h]; 37.109 + while (n != null && 37.110 + (n.getByteLength() != nbytes || 37.111 + !equals(bytes, n.index, bytes, nc, nbytes))) { 37.112 + n = n.next; 37.113 + } 37.114 + if (n == null) { 37.115 + n = new NameImpl(this); 37.116 + n.index = nc; 37.117 + n.length = nbytes; 37.118 + n.next = hashes[h]; 37.119 + hashes[h] = n; 37.120 + this.nc = nc + nbytes; 37.121 + if (nbytes == 0) { 37.122 + this.nc++; 37.123 + } 37.124 + } 37.125 + return n; 37.126 + } 37.127 + 37.128 + @Override 37.129 + public Name fromUtf(byte[] cs, int start, int len) { 37.130 + int h = hashValue(cs, start, len) & hashMask; 37.131 + NameImpl n = hashes[h]; 37.132 + byte[] names = this.bytes; 37.133 + while (n != null && 37.134 + (n.getByteLength() != len || !equals(names, n.index, cs, start, len))) { 37.135 + n = n.next; 37.136 + } 37.137 + if (n == null) { 37.138 + int nc = this.nc; 37.139 + while (nc + len > names.length) { 37.140 + // System.err.println("doubling name buffer of length + " + names.length + " to fit " + len + " bytes");//DEBUG 37.141 + byte[] newnames = new byte[names.length * 2]; 37.142 + System.arraycopy(names, 0, newnames, 0, names.length); 37.143 + names = this.bytes = newnames; 37.144 + } 37.145 + System.arraycopy(cs, start, names, nc, len); 37.146 + n = new NameImpl(this); 37.147 + n.index = nc; 37.148 + n.length = len; 37.149 + n.next = hashes[h]; 37.150 + hashes[h] = n; 37.151 + this.nc = nc + len; 37.152 + if (len == 0) { 37.153 + this.nc++; 37.154 + } 37.155 + } 37.156 + return n; 37.157 + } 37.158 + 37.159 + @Override 37.160 + public void dispose() { 37.161 + dispose(this); 37.162 + } 37.163 + 37.164 + static class NameImpl extends Name { 37.165 + /** The next name occupying the same hash bucket. 37.166 + */ 37.167 + NameImpl next; 37.168 + 37.169 + /** The index where the bytes of this name are stored in the global name 37.170 + * buffer `byte'. 37.171 + */ 37.172 + int index; 37.173 + 37.174 + /** The number of bytes in this name. 37.175 + */ 37.176 + int length; 37.177 + 37.178 + NameImpl(SharedNameTable table) { 37.179 + super(table); 37.180 + } 37.181 + 37.182 + @Override 37.183 + public int getIndex() { 37.184 + return index; 37.185 + } 37.186 + 37.187 + @Override 37.188 + public int getByteLength() { 37.189 + return length; 37.190 + } 37.191 + 37.192 + @Override 37.193 + public byte getByteAt(int i) { 37.194 + return getByteArray()[index + i]; 37.195 + } 37.196 + 37.197 + @Override 37.198 + public byte[] getByteArray() { 37.199 + return ((SharedNameTable) table).bytes; 37.200 + } 37.201 + 37.202 + @Override 37.203 + public int getByteOffset() { 37.204 + return index; 37.205 + } 37.206 + 37.207 + /** Return the hash value of this name. 37.208 + */ 37.209 + public int hashCode() { 37.210 + return index; 37.211 + } 37.212 + 37.213 + /** Is this name equal to other? 37.214 + */ 37.215 + public boolean equals(Object other) { 37.216 + if (other instanceof Name) 37.217 + return 37.218 + table == ((Name)other).table && index == ((Name) other).getIndex(); 37.219 + else return false; 37.220 + } 37.221 + 37.222 + } 37.223 + 37.224 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/src/share/classes/com/sun/tools/javac/util/UnsharedNameTable.java Tue Sep 16 18:35:18 2008 -0700 38.3 @@ -0,0 +1,185 @@ 38.4 +/* 38.5 + * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. 38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.7 + * 38.8 + * This code is free software; you can redistribute it and/or modify it 38.9 + * under the terms of the GNU General Public License version 2 only, as 38.10 + * published by the Free Software Foundation. Sun designates this 38.11 + * particular file as subject to the "Classpath" exception as provided 38.12 + * by Sun in the LICENSE file that accompanied this code. 38.13 + * 38.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 38.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38.17 + * version 2 for more details (a copy is included in the LICENSE file that 38.18 + * accompanied this code). 38.19 + * 38.20 + * You should have received a copy of the GNU General Public License version 38.21 + * 2 along with this work; if not, write to the Free Software Foundation, 38.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 38.23 + * 38.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 38.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 38.26 + * have any questions. 38.27 + */ 38.28 + 38.29 +package com.sun.tools.javac.util; 38.30 + 38.31 +import java.lang.ref.WeakReference; 38.32 + 38.33 +/** 38.34 + * Implementation of Name.Table that stores names in individual arrays 38.35 + * using weak references. It is recommended for use when a single shared 38.36 + * byte array is unsuitable. 38.37 + * 38.38 + * <p><b>This is NOT part of any API supported by Sun Microsystems. If 38.39 + * you write code that depends on this, you do so at your own risk. 38.40 + * This code and its internal interfaces are subject to change or 38.41 + * deletion without notice.</b> 38.42 + */ 38.43 +public class UnsharedNameTable extends Name.Table { 38.44 + static public Name.Table create(Names names) { 38.45 + return new UnsharedNameTable(names); 38.46 + } 38.47 + 38.48 + static class HashEntry extends WeakReference<NameImpl> { 38.49 + HashEntry next; 38.50 + HashEntry(NameImpl referent) { 38.51 + super(referent); 38.52 + } 38.53 + } 38.54 + 38.55 + /** The hash table for names. 38.56 + */ 38.57 + private HashEntry[] hashes = null; 38.58 + 38.59 + /** The mask to be used for hashing 38.60 + */ 38.61 + private int hashMask; 38.62 + 38.63 + /** Index counter for names in this table. 38.64 + */ 38.65 + public int index; 38.66 + 38.67 + /** Allocator 38.68 + * @param names The main name table 38.69 + * @param hashSize the (constant) size to be used for the hash table 38.70 + * needs to be a power of two. 38.71 + */ 38.72 + public UnsharedNameTable(Names names, int hashSize) { 38.73 + super(names); 38.74 + hashMask = hashSize - 1; 38.75 + hashes = new HashEntry[hashSize]; 38.76 + } 38.77 + 38.78 + public UnsharedNameTable(Names names) { 38.79 + this(names, 0x8000); 38.80 + } 38.81 + 38.82 + 38.83 + @Override 38.84 + public Name fromChars(char[] cs, int start, int len) { 38.85 + byte[] name = new byte[len * 3]; 38.86 + int nbytes = Convert.chars2utf(cs, start, name, 0, len); 38.87 + return fromUtf(name, 0, nbytes); 38.88 + } 38.89 + 38.90 + @Override 38.91 + public Name fromUtf(byte[] cs, int start, int len) { 38.92 + int h = hashValue(cs, start, len) & hashMask; 38.93 + 38.94 + HashEntry element = hashes[h]; 38.95 + 38.96 + NameImpl n = null; 38.97 + 38.98 + HashEntry previousNonNullTableEntry = null; 38.99 + HashEntry firstTableEntry = element; 38.100 + 38.101 + while (element != null) { 38.102 + if (element == null) { 38.103 + break; 38.104 + } 38.105 + 38.106 + n = element.get(); 38.107 + 38.108 + if (n == null) { 38.109 + if (firstTableEntry == element) { 38.110 + hashes[h] = firstTableEntry = element.next; 38.111 + } 38.112 + else { 38.113 + assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here."; 38.114 + previousNonNullTableEntry.next = element.next; 38.115 + } 38.116 + } 38.117 + else { 38.118 + if (n.getByteLength() == len && equals(n.bytes, 0, cs, start, len)) { 38.119 + return n; 38.120 + } 38.121 + previousNonNullTableEntry = element; 38.122 + } 38.123 + 38.124 + element = element.next; 38.125 + } 38.126 + 38.127 + byte[] bytes = new byte[len]; 38.128 + System.arraycopy(cs, start, bytes, 0, len); 38.129 + n = new NameImpl(this, bytes, index++); 38.130 + 38.131 + System.arraycopy(cs, start, n.bytes, 0, len); 38.132 + 38.133 + HashEntry newEntry = new HashEntry(n); 38.134 + 38.135 + if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode. 38.136 + hashes[h] = newEntry; 38.137 + } 38.138 + else { 38.139 + assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null."; 38.140 + previousNonNullTableEntry.next = newEntry; 38.141 + } 38.142 + 38.143 + return n; 38.144 + } 38.145 + 38.146 + @Override 38.147 + public void dispose() { 38.148 + hashes = null; 38.149 + } 38.150 + 38.151 + static class NameImpl extends Name { 38.152 + NameImpl(UnsharedNameTable table, byte[] bytes, int index) { 38.153 + super(table); 38.154 + this.bytes = bytes; 38.155 + this.index = index; 38.156 + } 38.157 + 38.158 + final byte[] bytes; 38.159 + final int index; 38.160 + 38.161 + @Override 38.162 + public int getIndex() { 38.163 + return index; 38.164 + } 38.165 + 38.166 + @Override 38.167 + public int getByteLength() { 38.168 + return bytes.length; 38.169 + } 38.170 + 38.171 + @Override 38.172 + public byte getByteAt(int i) { 38.173 + return bytes[i]; 38.174 + } 38.175 + 38.176 + @Override 38.177 + public byte[] getByteArray() { 38.178 + return bytes; 38.179 + } 38.180 + 38.181 + @Override 38.182 + public int getByteOffset() { 38.183 + return 0; 38.184 + } 38.185 + 38.186 + } 38.187 + 38.188 +}
39.1 --- a/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java Fri Sep 12 23:32:51 2008 -0700 39.2 +++ b/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java Tue Sep 16 18:35:18 2008 -0700 39.3 @@ -27,17 +27,13 @@ 39.4 39.5 import com.sun.javadoc.*; 39.6 39.7 -import static com.sun.javadoc.LanguageVersion.*; 39.8 39.9 -import com.sun.tools.javac.code.Flags; 39.10 import com.sun.tools.javac.code.Kinds; 39.11 import com.sun.tools.javac.code.Scope; 39.12 -import com.sun.tools.javac.code.Symbol; 39.13 import com.sun.tools.javac.code.Symbol.*; 39.14 import com.sun.tools.javac.tree.JCTree.*; 39.15 import com.sun.tools.javac.util.List; 39.16 -import com.sun.tools.javac.util.ListBuffer; 39.17 -import com.sun.tools.javac.util.Name; 39.18 +import com.sun.tools.javac.util.Names; 39.19 import com.sun.tools.javac.util.Position; 39.20 39.21 /** 39.22 @@ -93,7 +89,7 @@ 39.23 * Elements are always public, so no need to filter them. 39.24 */ 39.25 public AnnotationTypeElementDoc[] elements() { 39.26 - Name.Table names = tsym.name.table; 39.27 + Names names = tsym.name.table.names; 39.28 List<AnnotationTypeElementDoc> elements = List.nil(); 39.29 for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) { 39.30 if (e.sym != null && e.sym.kind == Kinds.MTH) {
40.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Fri Sep 12 23:32:51 2008 -0700 40.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Tue Sep 16 18:35:18 2008 -0700 40.3 @@ -25,8 +25,6 @@ 40.4 40.5 package com.sun.tools.javadoc; 40.6 40.7 -import java.util.*; 40.8 - 40.9 import com.sun.javadoc.*; 40.10 40.11 import static com.sun.javadoc.LanguageVersion.*; 40.12 @@ -40,7 +38,6 @@ 40.13 import com.sun.tools.javac.code.Kinds; 40.14 import com.sun.tools.javac.code.TypeTags; 40.15 import com.sun.tools.javac.code.Type; 40.16 -import com.sun.tools.javac.code.Types; 40.17 import com.sun.tools.javac.code.Type.ClassType; 40.18 import com.sun.tools.javac.code.Scope; 40.19 import com.sun.tools.javac.code.Symbol; 40.20 @@ -55,9 +52,9 @@ 40.21 import com.sun.tools.javac.tree.JCTree.JCClassDecl; 40.22 import com.sun.tools.javac.tree.TreeInfo; 40.23 40.24 +import com.sun.tools.javac.util.Names; 40.25 import static com.sun.tools.javac.code.Flags.*; 40.26 import static com.sun.tools.javac.code.Kinds.*; 40.27 -import static com.sun.tools.javac.code.TypeTags.*; 40.28 40.29 import java.io.File; 40.30 import java.util.Set; 40.31 @@ -549,7 +546,7 @@ 40.32 * methods in this class. Does not include constructors. 40.33 */ 40.34 public MethodDoc[] methods(boolean filter) { 40.35 - Name.Table names = tsym.name.table; 40.36 + Names names = tsym.name.table.names; 40.37 List<MethodDocImpl> methods = List.nil(); 40.38 for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) { 40.39 if (e.sym != null && 40.40 @@ -582,7 +579,7 @@ 40.41 * constructors in this class. 40.42 */ 40.43 public ConstructorDoc[] constructors(boolean filter) { 40.44 - Name.Table names = tsym.name.table; 40.45 + Names names = tsym.name.table.names; 40.46 List<ConstructorDocImpl> constructors = List.nil(); 40.47 for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) { 40.48 if (e.sym != null && 40.49 @@ -696,7 +693,7 @@ 40.50 } 40.51 40.52 private ClassDoc searchClass(String className) { 40.53 - Name.Table names = tsym.name.table; 40.54 + Names names = tsym.name.table.names; 40.55 40.56 // search by qualified name first 40.57 ClassDoc cd = env.lookupClass(className); 40.58 @@ -848,7 +845,7 @@ 40.59 *---------------------------------*/ 40.60 40.61 // search current class 40.62 - Name.Table names = tsym.name.table; 40.63 + Names names = tsym.name.table.names; 40.64 Scope.Entry e = tsym.members().lookup(names.fromString(methodName)); 40.65 40.66 //### Using modifier filter here isn't really correct, 40.67 @@ -936,7 +933,7 @@ 40.68 */ 40.69 public ConstructorDoc findConstructor(String constrName, 40.70 String[] paramTypes) { 40.71 - Name.Table names = tsym.name.table; 40.72 + Names names = tsym.name.table.names; 40.73 for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) { 40.74 if (e.sym.kind == Kinds.MTH) { 40.75 if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) { 40.76 @@ -973,7 +970,7 @@ 40.77 } 40.78 40.79 private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) { 40.80 - Name.Table names = tsym.name.table; 40.81 + Names names = tsym.name.table.names; 40.82 if (searched.contains(this)) { 40.83 return null; 40.84 } 40.85 @@ -1040,7 +1037,7 @@ 40.86 Env<AttrContext> compenv = env.enter.getEnv(tsym); 40.87 if (compenv == null) return new ClassDocImpl[0]; 40.88 40.89 - Name asterisk = tsym.name.table.asterisk; 40.90 + Name asterisk = tsym.name.table.names.asterisk; 40.91 for (JCTree t : compenv.toplevel.defs) { 40.92 if (t.getTag() == JCTree.IMPORT) { 40.93 JCTree imp = ((JCImport) t).qualid; 40.94 @@ -1076,7 +1073,7 @@ 40.95 ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<PackageDocImpl>(); 40.96 40.97 //### Add the implicit "import java.lang.*" to the result 40.98 - Name.Table names = tsym.name.table; 40.99 + Names names = tsym.name.table.names; 40.100 importedPackages.append(env.getPackageDoc(env.reader.enterPackage(names.java_lang))); 40.101 40.102 Env<AttrContext> compenv = env.enter.getEnv(tsym);
41.1 --- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java Fri Sep 12 23:32:51 2008 -0700 41.2 +++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java Tue Sep 16 18:35:18 2008 -0700 41.3 @@ -33,13 +33,11 @@ 41.4 import com.sun.tools.javac.code.*; 41.5 import com.sun.tools.javac.code.Symbol.*; 41.6 import com.sun.tools.javac.code.Type.ClassType; 41.7 -import com.sun.tools.javac.code.Type.TypeVar; 41.8 import com.sun.tools.javac.comp.Attr; 41.9 import com.sun.tools.javac.comp.Check; 41.10 import com.sun.tools.javac.tree.JCTree.*; 41.11 import com.sun.tools.javac.util.Context; 41.12 -import com.sun.tools.javac.util.List; 41.13 -import com.sun.tools.javac.util.Name; 41.14 +import com.sun.tools.javac.util.Names; 41.15 import com.sun.tools.javac.util.Position; 41.16 41.17 41.18 @@ -83,7 +81,7 @@ 41.19 JavadocEnter enter; 41.20 41.21 /** The name table. */ 41.22 - Name.Table names; 41.23 + Names names; 41.24 41.25 /** The encoding name. */ 41.26 private String encoding; 41.27 @@ -131,7 +129,7 @@ 41.28 reader = JavadocClassReader.instance0(context); 41.29 enter = JavadocEnter.instance0(context); 41.30 attr = Attr.instance(context); 41.31 - names = Name.Table.instance(context); 41.32 + names = Names.instance(context); 41.33 externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable")); 41.34 chk = Check.instance(context); 41.35 types = Types.instance(context);
42.1 --- a/src/share/classes/com/sun/tools/javadoc/SerializedForm.java Fri Sep 12 23:32:51 2008 -0700 42.2 +++ b/src/share/classes/com/sun/tools/javadoc/SerializedForm.java Tue Sep 16 18:35:18 2008 -0700 42.3 @@ -35,6 +35,7 @@ 42.4 import com.sun.tools.javac.code.Symbol.MethodSymbol; 42.5 import com.sun.tools.javac.util.Name; 42.6 import com.sun.tools.javac.util.ListBuffer; 42.7 +import com.sun.tools.javac.util.Names; 42.8 42.9 /** 42.10 * The serialized form is the specification of a class' serialization 42.11 @@ -149,7 +150,7 @@ 42.12 * name SERIALIZABLE_FIELDS. 42.13 */ 42.14 private VarSymbol getDefinedSerializableFields(ClassSymbol def) { 42.15 - Name.Table names = def.name.table; 42.16 + Names names = def.name.table.names; 42.17 42.18 /* SERIALIZABLE_FIELDS can be private, 42.19 * so must lookup by ClassSymbol, not by ClassDocImpl. 42.20 @@ -202,7 +203,7 @@ 42.21 * @param visibility the visibility flag for the given method. 42.22 */ 42.23 private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) { 42.24 - Name.Table names = def.name.table; 42.25 + Names names = def.name.table.names; 42.26 42.27 for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) { 42.28 if (e.sym.kind == Kinds.MTH) { 42.29 @@ -228,7 +229,7 @@ 42.30 private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc, 42.31 DocEnv env, 42.32 ClassSymbol def) { 42.33 - Name.Table names = def.name.table; 42.34 + Names names = def.name.table.names; 42.35 42.36 SerialFieldTag[] sfTag = spfDoc.serialFieldTags(); 42.37 for (int i = 0; i < sfTag.length; i++) {
43.1 --- a/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java Fri Sep 12 23:32:51 2008 -0700 43.2 +++ b/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java Tue Sep 16 18:35:18 2008 -0700 43.3 @@ -36,6 +36,7 @@ 43.4 import com.sun.tools.javac.code.Type.TypeVar; 43.5 import com.sun.tools.javac.util.List; 43.6 import com.sun.tools.javac.util.Name; 43.7 +import com.sun.tools.javac.util.Names; 43.8 43.9 /** 43.10 * Implementation of <code>TypeVariable</code>, which 43.11 @@ -66,7 +67,7 @@ 43.12 if ((osym.kind & Kinds.TYP) != 0) { 43.13 return env.getClassDoc((ClassSymbol)osym); 43.14 } 43.15 - Name.Table names = osym.name.table; 43.16 + Names names = osym.name.table.names; 43.17 if (osym.name == names.init) { 43.18 return env.getConstructorDoc((MethodSymbol)osym); 43.19 } else { 43.20 @@ -113,7 +114,7 @@ 43.21 */ 43.22 private static List<Type> getBounds(TypeVar v, DocEnv env) { 43.23 Name boundname = v.getUpperBound().tsym.getQualifiedName(); 43.24 - if (boundname == boundname.table.java_lang_Object) { 43.25 + if (boundname == boundname.table.names.java_lang_Object) { 43.26 return List.nil(); 43.27 } else { 43.28 return env.types.getBounds(v);
44.1 --- a/test/tools/javac/unit/util/convert/EnclosingCandidates.java Fri Sep 12 23:32:51 2008 -0700 44.2 +++ b/test/tools/javac/unit/util/convert/EnclosingCandidates.java Tue Sep 16 18:35:18 2008 -0700 44.3 @@ -36,7 +36,7 @@ 44.4 44.5 public class EnclosingCandidates { 44.6 44.7 - Name.Table names = Name.Table.instance(new Context()); 44.8 + Names names = Names.instance(new Context()); 44.9 44.10 void test(String name, String... expected) { 44.11 List<Name> result = enclosingCandidates(names.fromString(name));