mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
Reviewed-by: darcy, mcimadamore
This commit is contained in:
parent
4350001c77
commit
3ca95fc7a6
44 changed files with 1007 additions and 752 deletions
|
@ -33,7 +33,7 @@ import com.sun.tools.javac.code.Symbol.CompletionFailure;
|
|||
import com.sun.tools.javac.comp.Attr;
|
||||
import com.sun.tools.javac.comp.Enter;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ import com.sun.tools.javac.util.Name;
|
|||
|
||||
public class AptEnv {
|
||||
|
||||
public Name.Table names; // javac's name table
|
||||
public Names names; // javac's name table
|
||||
public Symtab symtab; // javac's predefined symbols
|
||||
public Types jctypes; // javac's type utilities
|
||||
public Enter enter; // javac's enter phase
|
||||
|
@ -66,7 +66,7 @@ public class AptEnv {
|
|||
private AptEnv(Context context) {
|
||||
context.put(aptEnvKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
symtab = Symtab.instance(context);
|
||||
jctypes = Types.instance(context);
|
||||
enter = Enter.instance(context);
|
||||
|
|
|
@ -166,7 +166,7 @@ public abstract class Attribute implements AnnotationValue {
|
|||
first = false;
|
||||
|
||||
Name name = value.fst.name;
|
||||
if (len > 1 || name != name.table.value) {
|
||||
if (len > 1 || name != name.table.names.value) {
|
||||
buf.append(name);
|
||||
buf.append('=');
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class Scope {
|
|||
assert shared == 0;
|
||||
if (table != next.table) return next;
|
||||
while (elems != null) {
|
||||
int hash = elems.sym.name.index & hashMask;
|
||||
int hash = elems.sym.name.hashCode() & hashMask;
|
||||
Entry e = table[hash];
|
||||
assert e == elems : elems.sym;
|
||||
table[hash] = elems.shadowed;
|
||||
|
@ -180,7 +180,7 @@ public class Scope {
|
|||
private void copy(Entry e) {
|
||||
if (e.sym != null) {
|
||||
copy(e.shadowed);
|
||||
int hash = e.sym.name.index & hashMask;
|
||||
int hash = e.sym.name.hashCode() & hashMask;
|
||||
e.shadowed = table[hash];
|
||||
table[hash] = e;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public class Scope {
|
|||
assert shared == 0;
|
||||
// Temporarily disabled (bug 6460352):
|
||||
// if (nelems * 3 >= hashMask * 2) dble();
|
||||
int hash = sym.name.index & hashMask;
|
||||
int hash = sym.name.hashCode() & hashMask;
|
||||
Entry e = makeEntry(sym, table[hash], elems, s, origin);
|
||||
table[hash] = e;
|
||||
elems = e;
|
||||
|
@ -227,9 +227,9 @@ public class Scope {
|
|||
if (e.scope == null) return;
|
||||
|
||||
// remove e from table and shadowed list;
|
||||
Entry te = table[sym.name.index & hashMask];
|
||||
Entry te = table[sym.name.hashCode() & hashMask];
|
||||
if (te == e)
|
||||
table[sym.name.index & hashMask] = e.shadowed;
|
||||
table[sym.name.hashCode() & hashMask] = e.shadowed;
|
||||
else while (true) {
|
||||
if (te.shadowed == e) {
|
||||
te.shadowed = e.shadowed;
|
||||
|
@ -279,7 +279,7 @@ public class Scope {
|
|||
* for regular entries.
|
||||
*/
|
||||
public Entry lookup(Name name) {
|
||||
Entry e = table[name.index & hashMask];
|
||||
Entry e = table[name.hashCode() & hashMask];
|
||||
while (e.scope != null && e.sym.name != name)
|
||||
e = e.shadowed;
|
||||
return e;
|
||||
|
@ -400,7 +400,7 @@ public class Scope {
|
|||
}
|
||||
|
||||
public Entry lookup(Name name) {
|
||||
Entry e = table[name.index & hashMask];
|
||||
Entry e = table[name.hashCode() & hashMask];
|
||||
while (e.scope != null &&
|
||||
(e.sym.name != name ||
|
||||
/* Since an inner class will show up in package and
|
||||
|
|
|
@ -146,14 +146,14 @@ public abstract class Symbol implements Element {
|
|||
* the default package; otherwise, the owner symbol is returned
|
||||
*/
|
||||
public Symbol location() {
|
||||
if (owner.name == null || (owner.name.len == 0 && owner.kind != PCK)) {
|
||||
if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK)) {
|
||||
return null;
|
||||
}
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Symbol location(Type site, Types types) {
|
||||
if (owner.name == null || owner.name.len == 0) {
|
||||
if (owner.name == null || owner.name.isEmpty()) {
|
||||
return location();
|
||||
}
|
||||
if (owner.type.tag == CLASS) {
|
||||
|
@ -177,7 +177,7 @@ public abstract class Symbol implements Element {
|
|||
*/
|
||||
public Type externalType(Types types) {
|
||||
Type t = erasure(types);
|
||||
if (name == name.table.init && owner.hasOuterInstance()) {
|
||||
if (name == name.table.names.init && owner.hasOuterInstance()) {
|
||||
Type outerThisType = types.erasure(owner.type.getEnclosingType());
|
||||
return new MethodType(t.getParameterTypes().prepend(outerThisType),
|
||||
t.getReturnType(),
|
||||
|
@ -212,7 +212,7 @@ public abstract class Symbol implements Element {
|
|||
/** Is this symbol a constructor?
|
||||
*/
|
||||
public boolean isConstructor() {
|
||||
return name == name.table.init;
|
||||
return name == name.table.names.init;
|
||||
}
|
||||
|
||||
/** The fully qualified name of this symbol.
|
||||
|
@ -501,7 +501,7 @@ public abstract class Symbol implements Element {
|
|||
|| (owner.kind == TYP && owner.type.tag == TYPEVAR)
|
||||
)) return name;
|
||||
Name prefix = owner.getQualifiedName();
|
||||
if (prefix == null || prefix == prefix.table.empty)
|
||||
if (prefix == null || prefix == prefix.table.names.empty)
|
||||
return name;
|
||||
else return prefix.append('.', name);
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ public abstract class Symbol implements Element {
|
|||
) return name;
|
||||
char sep = owner.kind == TYP ? '$' : '.';
|
||||
Name prefix = owner.flatName();
|
||||
if (prefix == null || prefix == prefix.table.empty)
|
||||
if (prefix == null || prefix == prefix.table.names.empty)
|
||||
return name;
|
||||
else return prefix.append(sep, name);
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ public abstract class Symbol implements Element {
|
|||
}
|
||||
|
||||
public String className() {
|
||||
if (name.len == 0)
|
||||
if (name.isEmpty())
|
||||
return
|
||||
Log.getLocalizedString("anonymous.class", flatname);
|
||||
else
|
||||
|
@ -1011,7 +1011,7 @@ public abstract class Symbol implements Element {
|
|||
if ((flags() & BLOCK) != 0) {
|
||||
return owner.name.toString();
|
||||
} else {
|
||||
String s = (name == name.table.init)
|
||||
String s = (name == name.table.names.init)
|
||||
? owner.name.toString()
|
||||
: name.toString();
|
||||
if (type != null) {
|
||||
|
@ -1208,9 +1208,9 @@ public abstract class Symbol implements Element {
|
|||
}
|
||||
|
||||
public ElementKind getKind() {
|
||||
if (name == name.table.init)
|
||||
if (name == name.table.names.init)
|
||||
return ElementKind.CONSTRUCTOR;
|
||||
else if (name == name.table.clinit)
|
||||
else if (name == name.table.names.clinit)
|
||||
return ElementKind.STATIC_INIT;
|
||||
else
|
||||
return ElementKind.METHOD;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Symtab {
|
|||
public final Type botType = new BottomType();
|
||||
public final JCNoType voidType = new JCNoType(TypeTags.VOID);
|
||||
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
private final ClassReader reader;
|
||||
private final Target target;
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class Symtab {
|
|||
protected Symtab(Context context) throws CompletionFailure {
|
||||
context.put(symtabKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
target = Target.instance(context);
|
||||
|
||||
// Create the unknown type
|
||||
|
|
|
@ -599,14 +599,14 @@ public class Type implements PrimitiveType {
|
|||
}
|
||||
//where
|
||||
private String className(Symbol sym, boolean longform) {
|
||||
if (sym.name.len == 0 && (sym.flags() & COMPOUND) != 0) {
|
||||
if (sym.name.isEmpty() && (sym.flags() & COMPOUND) != 0) {
|
||||
StringBuffer s = new StringBuffer(supertype_field.toString());
|
||||
for (List<Type> is=interfaces_field; is.nonEmpty(); is = is.tail) {
|
||||
s.append("&");
|
||||
s.append(is.head.toString());
|
||||
}
|
||||
return s.toString();
|
||||
} else if (sym.name.len == 0) {
|
||||
} else if (sym.name.isEmpty()) {
|
||||
String s;
|
||||
ClassType norm = (ClassType) tsym.type;
|
||||
if (norm == null) {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class Types {
|
|||
new Context.Key<Types>();
|
||||
|
||||
final Symtab syms;
|
||||
final Name.Table names;
|
||||
final Names names;
|
||||
final boolean allowBoxing;
|
||||
final ClassReader reader;
|
||||
final Source source;
|
||||
|
@ -86,7 +86,7 @@ public class Types {
|
|||
protected Types(Context context) {
|
||||
context.put(typesKey, this);
|
||||
syms = Symtab.instance(context);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
allowBoxing = Source.instance(context).allowBoxing();
|
||||
reader = ClassReader.instance(context);
|
||||
source = Source.instance(context);
|
||||
|
@ -2213,7 +2213,7 @@ public class Types {
|
|||
ClassType cls = (ClassType)t;
|
||||
if (cls.rank_field < 0) {
|
||||
Name fullname = cls.tsym.getQualifiedName();
|
||||
if (fullname == fullname.table.java_lang_Object)
|
||||
if (fullname == names.java_lang_Object)
|
||||
cls.rank_field = 0;
|
||||
else {
|
||||
int r = rank(supertype(cls));
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Annotate {
|
|||
final TreeMaker make;
|
||||
final Log log;
|
||||
final Symtab syms;
|
||||
final Name.Table names;
|
||||
final Names names;
|
||||
final Resolve rs;
|
||||
final Types types;
|
||||
final ConstFold cfolder;
|
||||
|
@ -67,7 +67,7 @@ public class Annotate {
|
|||
make = TreeMaker.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
rs = Resolve.instance(context);
|
||||
types = Types.instance(context);
|
||||
cfolder = ConstFold.instance(context);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class Attr extends JCTree.Visitor {
|
|||
protected static final Context.Key<Attr> attrKey =
|
||||
new Context.Key<Attr>();
|
||||
|
||||
final Name.Table names;
|
||||
final Names names;
|
||||
final Log log;
|
||||
final Symtab syms;
|
||||
final Resolve rs;
|
||||
|
@ -92,7 +92,7 @@ public class Attr extends JCTree.Visitor {
|
|||
protected Attr(Context context) {
|
||||
context.put(attrKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
rs = Resolve.instance(context);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class Check {
|
|||
protected static final Context.Key<Check> checkKey =
|
||||
new Context.Key<Check>();
|
||||
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
private final Log log;
|
||||
private final Symtab syms;
|
||||
private final Infer infer;
|
||||
|
@ -82,7 +82,7 @@ public class Check {
|
|||
protected Check(Context context) {
|
||||
context.put(checkKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
infer = Infer.instance(context);
|
||||
|
@ -628,7 +628,7 @@ public class Check {
|
|||
case TYP:
|
||||
if (sym.isLocal()) {
|
||||
mask = LocalClassFlags;
|
||||
if (sym.name.len == 0) { // Anonymous class
|
||||
if (sym.name.isEmpty()) { // Anonymous class
|
||||
// Anonymous classes in static methods are themselves static;
|
||||
// that's why we admit STATIC here.
|
||||
mask |= STATIC;
|
||||
|
|
|
@ -333,7 +333,7 @@ public class Enter extends JCTree.Visitor {
|
|||
"class.public.should.be.in.file", tree.name);
|
||||
}
|
||||
} else {
|
||||
if (tree.name.len != 0 &&
|
||||
if (!tree.name.isEmpty() &&
|
||||
!chk.checkUniqueClassName(tree.pos(), tree.name, enclScope)) {
|
||||
result = null;
|
||||
return;
|
||||
|
@ -348,7 +348,7 @@ public class Enter extends JCTree.Visitor {
|
|||
// We are seeing a local class.
|
||||
c = reader.defineClass(tree.name, owner);
|
||||
c.flatname = chk.localClassName(c);
|
||||
if (c.name.len != 0)
|
||||
if (!c.name.isEmpty())
|
||||
chk.checkTransparentClass(tree.pos(), c, env.info.scope);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ public class Flow extends TreeScanner {
|
|||
protected static final Context.Key<Flow> flowKey =
|
||||
new Context.Key<Flow>();
|
||||
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
private final Log log;
|
||||
private final Symtab syms;
|
||||
private final Types types;
|
||||
|
@ -195,7 +195,7 @@ public class Flow extends TreeScanner {
|
|||
protected Flow(Context context) {
|
||||
context.put(flowKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
types = Types.instance(context);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class Lower extends TreeTranslator {
|
|||
return instance;
|
||||
}
|
||||
|
||||
private Name.Table names;
|
||||
private Names names;
|
||||
private Log log;
|
||||
private Symtab syms;
|
||||
private Resolve rs;
|
||||
|
@ -85,7 +85,7 @@ public class Lower extends TreeTranslator {
|
|||
|
||||
protected Lower(Context context) {
|
||||
context.put(lowerKey, this);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
rs = Resolve.instance(context);
|
||||
|
@ -1830,7 +1830,7 @@ public class Lower extends TreeTranslator {
|
|||
}
|
||||
VarSymbol var =
|
||||
new VarSymbol(FINAL|SYNTHETIC,
|
||||
Name.fromString(names,
|
||||
names.fromString(
|
||||
target.syntheticNameChar()
|
||||
+ "" + rval.hashCode()),
|
||||
type,
|
||||
|
@ -3338,7 +3338,7 @@ public class Lower extends TreeTranslator {
|
|||
ListBuffer<JCStatement> blockStatements = new ListBuffer<JCStatement>();
|
||||
|
||||
JCModifiers mod1 = make.Modifiers(0L);
|
||||
Name oName = Name.fromString(names, "o");
|
||||
Name oName = names.fromString("o");
|
||||
JCVariableDecl par1 = make.Param(oName, cdef.type, compareToSym);
|
||||
|
||||
JCIdent paramId1 = make.Ident(names.java_lang_Object);
|
||||
|
@ -3352,7 +3352,7 @@ public class Lower extends TreeTranslator {
|
|||
JCTypeCast cast = make.TypeCast(castTargetIdent, par1UsageId);
|
||||
cast.setType(castTargetIdent.type);
|
||||
|
||||
Name otherName = Name.fromString(names, "other");
|
||||
Name otherName = names.fromString("other");
|
||||
|
||||
VarSymbol otherVarSym = new VarSymbol(mod1.flags,
|
||||
otherName,
|
||||
|
|
|
@ -61,7 +61,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||
*/
|
||||
final static boolean checkClash = true;
|
||||
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
private final Enter enter;
|
||||
private final Log log;
|
||||
private final Check chk;
|
||||
|
@ -86,7 +86,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||
|
||||
protected MemberEnter(Context context) {
|
||||
context.put(memberEnterKey, this);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
enter = Enter.instance(context);
|
||||
log = Log.instance(context);
|
||||
chk = Check.instance(context);
|
||||
|
@ -919,7 +919,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||
List<Type> thrown = List.nil();
|
||||
long ctorFlags = 0;
|
||||
boolean based = false;
|
||||
if (c.name.len == 0) {
|
||||
if (c.name.isEmpty()) {
|
||||
JCNewClass nc = (JCNewClass)env.next.tree;
|
||||
if (nc.constructor != null) {
|
||||
Type superConstrType = types.memberType(c.type,
|
||||
|
@ -1068,7 +1068,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||
flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
|
||||
} else
|
||||
flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
|
||||
if (c.name.len == 0) flags |= ANONCONSTR;
|
||||
if (c.name.isEmpty()) flags |= ANONCONSTR;
|
||||
JCTree result = make.MethodDef(
|
||||
make.Modifiers(flags),
|
||||
names.init,
|
||||
|
|
|
@ -51,7 +51,7 @@ public class Resolve {
|
|||
protected static final Context.Key<Resolve> resolveKey =
|
||||
new Context.Key<Resolve>();
|
||||
|
||||
Name.Table names;
|
||||
Names names;
|
||||
Log log;
|
||||
Symtab syms;
|
||||
Check chk;
|
||||
|
@ -86,7 +86,7 @@ public class Resolve {
|
|||
typeNotFound = new
|
||||
ResolveError(ABSENT_TYP, syms.errSymbol, "type not found");
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
chk = Check.instance(context);
|
||||
infer = Infer.instance(context);
|
||||
|
@ -1538,7 +1538,7 @@ public class Resolve {
|
|||
argtypes = List.nil();
|
||||
if (typeargtypes == null)
|
||||
typeargtypes = List.nil();
|
||||
if (name != name.table.error) {
|
||||
if (name != names.error) {
|
||||
KindName kindname = absentKind(kind);
|
||||
Name idname = name;
|
||||
if (kind >= WRONG_MTHS && kind <= ABSENT_MTH) {
|
||||
|
@ -1547,7 +1547,7 @@ public class Resolve {
|
|||
name, argtypes);
|
||||
return;
|
||||
}
|
||||
if (name == name.table.init) {
|
||||
if (name == names.init) {
|
||||
kindname = KindName.CONSTRUCTOR;
|
||||
idname = site.tsym.name;
|
||||
}
|
||||
|
@ -1563,7 +1563,7 @@ public class Resolve {
|
|||
kindName(ws.owner),
|
||||
ws.owner.type,
|
||||
explanation);
|
||||
} else if (site.tsym.name.len != 0) {
|
||||
} else if (!site.tsym.name.isEmpty()) {
|
||||
if (site.tsym.kind == PCK && !site.tsym.exists())
|
||||
log.error(pos, "doesnt.exist", site.tsym);
|
||||
else {
|
||||
|
@ -1601,9 +1601,9 @@ public class Resolve {
|
|||
*/
|
||||
boolean isOperator(Name name) {
|
||||
int i = 0;
|
||||
while (i < name.len &&
|
||||
"+-~!*/%&|^<>=".indexOf(name.byteAt(i)) >= 0) i++;
|
||||
return i > 0 && i == name.len;
|
||||
while (i < name.getByteLength() &&
|
||||
"+-~!*/%&|^<>=".indexOf(name.getByteAt(i)) >= 0) i++;
|
||||
return i > 0 && i == name.getByteLength();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1639,7 +1639,7 @@ public class Resolve {
|
|||
void report(Log log, DiagnosticPosition pos, Type site, Name name,
|
||||
List<Type> argtypes, List<Type> typeargtypes) {
|
||||
if (sym.owner.type.tag != ERROR) {
|
||||
if (sym.name == sym.name.table.init && sym.owner != site.tsym)
|
||||
if (sym.name == names.init && sym.owner != site.tsym)
|
||||
new ResolveError(ABSENT_MTH, sym.owner, "absent method " + sym).report(
|
||||
log, pos, site, name, argtypes, typeargtypes);
|
||||
if ((sym.flags() & PUBLIC) != 0
|
||||
|
@ -1723,7 +1723,7 @@ public class Resolve {
|
|||
else break;
|
||||
}
|
||||
Name sname = pair.sym1.name;
|
||||
if (sname == sname.table.init) sname = pair.sym1.owner.name;
|
||||
if (sname == names.init) sname = pair.sym1.owner.name;
|
||||
log.error(pos, "ref.ambiguous", sname,
|
||||
kindName(pair.sym1),
|
||||
pair.sym1,
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TransTypes extends TreeTranslator {
|
|||
return instance;
|
||||
}
|
||||
|
||||
private Name.Table names;
|
||||
private Names names;
|
||||
private Log log;
|
||||
private Symtab syms;
|
||||
private TreeMaker make;
|
||||
|
@ -77,7 +77,7 @@ public class TransTypes extends TreeTranslator {
|
|||
|
||||
protected TransTypes(Context context) {
|
||||
context.put(transTypesKey, this);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
enter = Enter.instance(context);
|
||||
|
|
|
@ -108,7 +108,7 @@ public class ClassFile {
|
|||
* converting '/' to '.'.
|
||||
*/
|
||||
public static byte[] internalize(Name name) {
|
||||
return internalize(name.table.names, name.index, name.len);
|
||||
return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
|
||||
}
|
||||
|
||||
/** Return external representation of buf[offset..offset+len-1],
|
||||
|
@ -128,7 +128,7 @@ public class ClassFile {
|
|||
* converting '/' to '.'.
|
||||
*/
|
||||
public static byte[] externalize(Name name) {
|
||||
return externalize(name.table.names, name.index, name.len);
|
||||
return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength());
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ClassReader extends ClassFile implements Completer {
|
|||
Types types;
|
||||
|
||||
/** The name table. */
|
||||
final Name.Table names;
|
||||
final Names names;
|
||||
|
||||
/** Force a completion failure on this name
|
||||
*/
|
||||
|
@ -220,7 +220,7 @@ public class ClassReader extends ClassFile implements Completer {
|
|||
protected ClassReader(Context context, boolean definitive) {
|
||||
if (definitive) context.put(classReaderKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
types = Types.instance(context);
|
||||
fileManager = context.get(JavaFileManager.class);
|
||||
|
@ -516,14 +516,6 @@ public class ClassReader extends ClassFile implements Completer {
|
|||
int siglimit;
|
||||
boolean sigEnterPhase = false;
|
||||
|
||||
/** Convert signature to type, where signature is a name.
|
||||
*/
|
||||
Type sigToType(Name sig) {
|
||||
return sig == null
|
||||
? null
|
||||
: sigToType(sig.table.names, sig.index, sig.len);
|
||||
}
|
||||
|
||||
/** Convert signature to type, where signature is a byte array segment.
|
||||
*/
|
||||
Type sigToType(byte[] sig, int offset, int len) {
|
||||
|
@ -741,12 +733,6 @@ public class ClassReader extends ClassFile implements Completer {
|
|||
return head.tail;
|
||||
}
|
||||
|
||||
/** Convert signature to type parameters, where signature is a name.
|
||||
*/
|
||||
List<Type> sigToTypeParams(Name name) {
|
||||
return sigToTypeParams(name.table.names, name.index, name.len);
|
||||
}
|
||||
|
||||
/** Convert signature to type parameters, where signature is a byte
|
||||
* array segment.
|
||||
*/
|
||||
|
@ -952,7 +938,7 @@ public class ClassReader extends ClassFile implements Completer {
|
|||
|
||||
self.name = simpleBinaryName(self.flatname, c.flatname) ;
|
||||
self.owner = m != null ? m : c;
|
||||
if (self.name.len == 0)
|
||||
if (self.name.isEmpty())
|
||||
self.fullname = null;
|
||||
else
|
||||
self.fullname = ClassSymbol.formFullName(self.name, self.owner);
|
||||
|
@ -1500,7 +1486,7 @@ public class ClassReader extends ClassFile implements Completer {
|
|||
// Sometimes anonymous classes don't have an outer
|
||||
// instance, however, there is no reliable way to tell so
|
||||
// we never strip this$n
|
||||
if (currentOwner.name.len != 0)
|
||||
if (!currentOwner.name.isEmpty())
|
||||
type = new MethodType(type.getParameterTypes().tail,
|
||||
type.getReturnType(),
|
||||
type.getThrownTypes(),
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
package com.sun.tools.javac.jvm;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
|
@ -140,7 +139,7 @@ public class ClassWriter extends ClassFile {
|
|||
private final Log log;
|
||||
|
||||
/** The name table. */
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
|
||||
/** Access to files. */
|
||||
private final JavaFileManager fileManager;
|
||||
|
@ -166,7 +165,7 @@ public class ClassWriter extends ClassFile {
|
|||
context.put(classWriterKey, this);
|
||||
|
||||
log = Log.instance(context);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
options = Options.instance(context);
|
||||
target = Target.instance(context);
|
||||
|
@ -375,9 +374,7 @@ public class ClassWriter extends ClassFile {
|
|||
sigbuf.appendByte('.');
|
||||
assert c.flatname.startsWith(c.owner.enclClass().flatname);
|
||||
sigbuf.appendName(rawOuter
|
||||
? c.flatname.subName(c.owner.enclClass()
|
||||
.flatname.len+1,
|
||||
c.flatname.len)
|
||||
? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
|
||||
: c.name);
|
||||
} else {
|
||||
sigbuf.appendBytes(externalize(c.flatname));
|
||||
|
@ -542,7 +539,7 @@ public class ClassWriter extends ClassFile {
|
|||
Name fieldName(Symbol sym) {
|
||||
if (scramble && (sym.flags() & PRIVATE) != 0 ||
|
||||
scrambleAll && (sym.flags() & (PROTECTED | PUBLIC)) == 0)
|
||||
return names.fromString("_$" + sym.name.index);
|
||||
return names.fromString("_$" + sym.name.getIndex());
|
||||
else
|
||||
return sym.name;
|
||||
}
|
||||
|
@ -917,7 +914,7 @@ public class ClassWriter extends ClassFile {
|
|||
databuf.appendChar(
|
||||
inner.owner.kind == TYP ? pool.get(inner.owner) : 0);
|
||||
databuf.appendChar(
|
||||
inner.name.len != 0 ? pool.get(inner.name) : 0);
|
||||
!inner.name.isEmpty() ? pool.get(inner.name) : 0);
|
||||
databuf.appendChar(flags);
|
||||
}
|
||||
endAttr(alenIdx);
|
||||
|
@ -1457,7 +1454,7 @@ public class ClassWriter extends ClassFile {
|
|||
try {
|
||||
writeClassFile(out, c);
|
||||
if (verbose)
|
||||
log.errWriter.println(log.getLocalizedString("verbose.wrote.file", outFile));
|
||||
log.errWriter.println(Log.getLocalizedString("verbose.wrote.file", outFile));
|
||||
out.close();
|
||||
out = null;
|
||||
} finally {
|
||||
|
|
|
@ -52,16 +52,16 @@ public class Code {
|
|||
public enum StackMapFormat {
|
||||
NONE,
|
||||
CLDC {
|
||||
Name getAttributeName(Name.Table names) {
|
||||
Name getAttributeName(Names names) {
|
||||
return names.StackMap;
|
||||
}
|
||||
},
|
||||
JSR202 {
|
||||
Name getAttributeName(Name.Table names) {
|
||||
Name getAttributeName(Names names) {
|
||||
return names.StackMapTable;
|
||||
}
|
||||
};
|
||||
Name getAttributeName(Name.Table names) {
|
||||
Name getAttributeName(Names names) {
|
||||
return names.empty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class Gen extends JCTree.Visitor {
|
|||
private final Check chk;
|
||||
private final Resolve rs;
|
||||
private final TreeMaker make;
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
private final Target target;
|
||||
private final Type stringBufferType;
|
||||
private final Map<Type,Symbol> stringBufferAppend;
|
||||
|
@ -92,7 +92,7 @@ public class Gen extends JCTree.Visitor {
|
|||
protected Gen(Context context) {
|
||||
context.put(genKey, this);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
chk = Check.instance(context);
|
||||
|
@ -365,7 +365,7 @@ public class Gen extends JCTree.Visitor {
|
|||
private boolean isOddAccessName(Name name) {
|
||||
return
|
||||
name.startsWith(accessDollar) &&
|
||||
(name.byteAt(name.len - 1) & 1) == 1;
|
||||
(name.getByteAt(name.getByteLength() - 1) & 1) == 1;
|
||||
}
|
||||
|
||||
/* ************************************************************************
|
||||
|
|
|
@ -236,7 +236,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
|||
|
||||
/** The name table.
|
||||
*/
|
||||
protected Name.Table names;
|
||||
protected Names names;
|
||||
|
||||
/** The attributor.
|
||||
*/
|
||||
|
@ -310,7 +310,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
|||
if (context.get(JavaFileManager.class) == null)
|
||||
JavacFileManager.preRegister(context);
|
||||
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
log = Log.instance(context);
|
||||
diagFactory = JCDiagnostic.Factory.instance(context);
|
||||
reader = ClassReader.instance(context);
|
||||
|
@ -1411,7 +1411,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
|||
close(true);
|
||||
}
|
||||
|
||||
private void close(boolean disposeNames) {
|
||||
public void close(boolean disposeNames) {
|
||||
rootClasses = null;
|
||||
reader = null;
|
||||
make = null;
|
||||
|
|
|
@ -181,7 +181,7 @@ public class AnnotationProxyMaker {
|
|||
public void visitArray(Attribute.Array a) {
|
||||
Name elemName = ((ArrayType) a.type).elemtype.tsym.name;
|
||||
|
||||
if (elemName == elemName.table.java_lang_Class) { // Class[]
|
||||
if (elemName == elemName.table.names.java_lang_Class) { // Class[]
|
||||
// Construct a proxy for a MirroredTypesException
|
||||
List<TypeMirror> elems = List.nil();
|
||||
for (Attribute value : a.values) {
|
||||
|
|
|
@ -39,15 +39,14 @@ import com.sun.tools.javac.code.TypeTags;
|
|||
import com.sun.tools.javac.comp.AttrContext;
|
||||
import com.sun.tools.javac.comp.Enter;
|
||||
import com.sun.tools.javac.comp.Env;
|
||||
import com.sun.tools.javac.jvm.ClassReader;
|
||||
import com.sun.tools.javac.main.JavaCompiler;
|
||||
import com.sun.tools.javac.processing.PrintingProcessor;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.*;
|
||||
import com.sun.tools.javac.tree.TreeInfo;
|
||||
import com.sun.tools.javac.tree.TreeScanner;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.*;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
|
||||
import static javax.lang.model.util.ElementFilter.methodsIn;
|
||||
|
||||
|
@ -63,10 +62,9 @@ public class JavacElements implements Elements {
|
|||
|
||||
private JavaCompiler javaCompiler;
|
||||
private Symtab syms;
|
||||
private Name.Table names;
|
||||
private Names names;
|
||||
private Types types;
|
||||
private Enter enter;
|
||||
private ClassReader reader;
|
||||
|
||||
private static final Context.Key<JavacElements> KEY =
|
||||
new Context.Key<JavacElements>();
|
||||
|
@ -96,10 +94,9 @@ public class JavacElements implements Elements {
|
|||
public void setContext(Context context) {
|
||||
javaCompiler = JavaCompiler.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
types = Types.instance(context);
|
||||
enter = Enter.instance(context);
|
||||
reader = ClassReader.instance(context);
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,7 +123,7 @@ public class JavacElements implements Elements {
|
|||
Class<A> annoType) {
|
||||
boolean inherited = annoType.isAnnotationPresent(Inherited.class);
|
||||
A result = null;
|
||||
while (annotated.name != annotated.name.table.java_lang_Object) {
|
||||
while (annotated.name != annotated.name.table.names.java_lang_Object) {
|
||||
result = getAnnotation((Symbol)annotated, annoType);
|
||||
if (result != null || !inherited)
|
||||
break;
|
||||
|
@ -568,7 +565,7 @@ public class JavacElements implements Elements {
|
|||
}
|
||||
|
||||
public Name getName(CharSequence cs) {
|
||||
return Name.fromString(names, cs.toString());
|
||||
return names.fromString(cs.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,7 +73,7 @@ public class JavacParser implements Parser {
|
|||
private Source source;
|
||||
|
||||
/** The name table. */
|
||||
private Name.Table names;
|
||||
private Names names;
|
||||
|
||||
/** Construct a parser from a given scanner, tree factory and log.
|
||||
*/
|
||||
|
@ -549,7 +549,7 @@ public class JavacParser implements Parser {
|
|||
|
||||
String strval(Name prefix) {
|
||||
String s = S.stringVal();
|
||||
return (prefix.len == 0) ? s : prefix + s;
|
||||
return prefix.isEmpty() ? s : prefix + s;
|
||||
}
|
||||
|
||||
/** terms can be either expressions or types.
|
||||
|
|
|
@ -28,6 +28,7 @@ package com.sun.tools.javac.parser;
|
|||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.Log;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
|
||||
import static com.sun.tools.javac.parser.Token.*;
|
||||
|
||||
|
@ -51,12 +52,12 @@ public class Keywords {
|
|||
}
|
||||
|
||||
private final Log log;
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
|
||||
protected Keywords(Context context) {
|
||||
context.put(keywordsKey, this);
|
||||
log = Log.instance(context);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
|
||||
for (Token t : Token.values()) {
|
||||
if (t.name != null)
|
||||
|
@ -69,13 +70,13 @@ public class Keywords {
|
|||
for (int i = 0; i <= maxKey; i++) key[i] = IDENTIFIER;
|
||||
for (Token t : Token.values()) {
|
||||
if (t.name != null)
|
||||
key[tokenName[t.ordinal()].index] = t;
|
||||
key[tokenName[t.ordinal()].getIndex()] = t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Token key(Name name) {
|
||||
return (name.index > maxKey) ? IDENTIFIER : key[name.index];
|
||||
return (name.getIndex() > maxKey) ? IDENTIFIER : key[name.getIndex()];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,6 +95,6 @@ public class Keywords {
|
|||
private void enterKeyword(String s, Token token) {
|
||||
Name n = names.fromString(s);
|
||||
tokenName[token.ordinal()] = n;
|
||||
if (n.index > maxKey) maxKey = n.index;
|
||||
if (n.getIndex() > maxKey) maxKey = n.getIndex();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.sun.tools.javac.code.Source;
|
|||
import com.sun.tools.javac.tree.TreeMaker;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.Log;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import com.sun.tools.javac.util.Options;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ public class ParserFactory {
|
|||
final Log log;
|
||||
final Keywords keywords;
|
||||
final Source source;
|
||||
final Name.Table names;
|
||||
final Names names;
|
||||
final Options options;
|
||||
final Scanner.Factory scannerFactory;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ParserFactory {
|
|||
context.put(parserFactoryKey, this);
|
||||
this.F = TreeMaker.instance(context);
|
||||
this.log = Log.instance(context);
|
||||
this.names = Name.Table.instance(context);
|
||||
this.names = Names.instance(context);
|
||||
this.keywords = Keywords.instance(context);
|
||||
this.source = Source.instance(context);
|
||||
this.options = Options.instance(context);
|
||||
|
|
|
@ -62,7 +62,7 @@ public class Scanner implements Lexer {
|
|||
}
|
||||
|
||||
final Log log;
|
||||
final Name.Table names;
|
||||
final Names names;
|
||||
final Source source;
|
||||
final Keywords keywords;
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class Scanner implements Lexer {
|
|||
protected Factory(Context context) {
|
||||
context.put(scannerFactoryKey, this);
|
||||
this.log = Log.instance(context);
|
||||
this.names = Name.Table.instance(context);
|
||||
this.names = Names.instance(context);
|
||||
this.source = Source.instance(context);
|
||||
this.keywords = Keywords.instance(context);
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class Scanner implements Lexer {
|
|||
private final Log log;
|
||||
|
||||
/** The name table. */
|
||||
private final Name.Table names;
|
||||
private final Names names;
|
||||
|
||||
/** The keyword table. */
|
||||
private final Keywords keywords;
|
||||
|
|
|
@ -70,6 +70,7 @@ import com.sun.tools.javac.util.List;
|
|||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Log;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import com.sun.tools.javac.util.Options;
|
||||
|
||||
import static javax.tools.StandardLocation.*;
|
||||
|
@ -831,7 +832,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
topLevelClasses = List.nil();
|
||||
packageInfoFiles = List.nil();
|
||||
|
||||
compiler.close();
|
||||
compiler.close(false);
|
||||
currentContext = contextForNextRound(currentContext, true);
|
||||
|
||||
JavaFileManager fileManager = currentContext.get(JavaFileManager.class);
|
||||
|
@ -879,7 +880,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
}
|
||||
runLastRound(xout, roundNumber, errorStatus, taskListener);
|
||||
|
||||
compiler.close();
|
||||
compiler.close(false);
|
||||
currentContext = contextForNextRound(currentContext, true);
|
||||
compiler = JavaCompiler.instance(currentContext);
|
||||
filer.newRound(currentContext, true);
|
||||
|
@ -913,7 +914,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
} else if (procOnly) {
|
||||
compiler.todo.clear();
|
||||
} else { // Final compilation
|
||||
compiler.close();
|
||||
compiler.close(false);
|
||||
currentContext = contextForNextRound(currentContext, true);
|
||||
compiler = JavaCompiler.instance(currentContext);
|
||||
|
||||
|
@ -987,7 +988,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
|
||||
private ListBuffer<ClassSymbol> enterNewClassFiles(Context currentContext) {
|
||||
ClassReader reader = ClassReader.instance(currentContext);
|
||||
Name.Table names = Name.Table.instance(currentContext);
|
||||
Names names = Names.instance(currentContext);
|
||||
ListBuffer<ClassSymbol> list = new ListBuffer<ClassSymbol>();
|
||||
|
||||
for (Map.Entry<String,JavaFileObject> entry : filer.getGeneratedClasses().entrySet()) {
|
||||
|
@ -1047,9 +1048,9 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
next.put(Log.outKey, out);
|
||||
|
||||
if (shareNames) {
|
||||
Name.Table names = Name.Table.instance(context);
|
||||
Names names = Names.instance(context);
|
||||
assert names != null;
|
||||
next.put(Name.Table.namesKey, names);
|
||||
next.put(Names.namesKey, names);
|
||||
}
|
||||
|
||||
DiagnosticListener dl = context.get(DiagnosticListener.class);
|
||||
|
@ -1067,9 +1068,9 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
|||
((JavacFileManager)jfm).setContext(next);
|
||||
}
|
||||
|
||||
Name.Table names = Name.Table.instance(context);
|
||||
Names names = Names.instance(context);
|
||||
assert names != null;
|
||||
next.put(Name.Table.namesKey, names);
|
||||
next.put(Names.namesKey, names);
|
||||
|
||||
Keywords keywords = Keywords.instance(context);
|
||||
assert(keywords != null);
|
||||
|
|
|
@ -336,7 +336,7 @@ public class Pretty extends JCTree.Visitor {
|
|||
if (l.head.getTag() == JCTree.IMPORT) {
|
||||
JCImport imp = (JCImport)l.head;
|
||||
Name name = TreeInfo.name(imp.qualid);
|
||||
if (name == name.table.asterisk ||
|
||||
if (name == name.table.names.asterisk ||
|
||||
cdef == null ||
|
||||
isUsed(TreeInfo.symbol(imp.qualid), cdef)) {
|
||||
if (firstImport) {
|
||||
|
@ -439,14 +439,14 @@ public class Pretty extends JCTree.Visitor {
|
|||
public void visitMethodDef(JCMethodDecl tree) {
|
||||
try {
|
||||
// when producing source output, omit anonymous constructors
|
||||
if (tree.name == tree.name.table.init &&
|
||||
if (tree.name == tree.name.table.names.init &&
|
||||
enclClassName == null &&
|
||||
sourceOutput) return;
|
||||
println(); align();
|
||||
printDocComment(tree);
|
||||
printExpr(tree.mods);
|
||||
printTypeParameters(tree.typarams);
|
||||
if (tree.name == tree.name.table.init) {
|
||||
if (tree.name == tree.name.table.names.init) {
|
||||
print(enclClassName != null ? enclClassName : tree.name);
|
||||
} else {
|
||||
printExpr(tree.restype);
|
||||
|
@ -835,8 +835,8 @@ public class Pretty extends JCTree.Visitor {
|
|||
Name enclClassNamePrev = enclClassName;
|
||||
enclClassName =
|
||||
tree.def.name != null ? tree.def.name :
|
||||
tree.type != null && tree.type.tsym.name != tree.type.tsym.name.table.empty ? tree.type.tsym.name :
|
||||
null;
|
||||
tree.type != null && tree.type.tsym.name != tree.type.tsym.name.table.names.empty
|
||||
? tree.type.tsym.name : null;
|
||||
if ((tree.def.mods.flags & Flags.ENUM) != 0) print("/*enum*/");
|
||||
printBlock(tree.def.defs);
|
||||
enclClassName = enclClassNamePrev;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class TreeInfo {
|
|||
private TreeInfo(Context context) {
|
||||
context.put(treeInfoKey, this);
|
||||
|
||||
Name.Table names = Name.Table.instance(context);
|
||||
Names names = Names.instance(context);
|
||||
opname[JCTree.POS - JCTree.POS] = names.fromString("+");
|
||||
opname[JCTree.NEG - JCTree.POS] = names.hyphen;
|
||||
opname[JCTree.NOT - JCTree.POS] = names.fromString("!");
|
||||
|
@ -104,7 +104,7 @@ public class TreeInfo {
|
|||
public static boolean isConstructor(JCTree tree) {
|
||||
if (tree.getTag() == JCTree.METHODDEF) {
|
||||
Name name = ((JCMethodDecl) tree).name;
|
||||
return name == name.table.init;
|
||||
return name == name.table.names.init;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class TreeInfo {
|
|||
if (select.sym != null &&
|
||||
(select.sym.flags() & SYNTHETIC) != 0) {
|
||||
Name selected = name(select.selected);
|
||||
if (selected != null && selected == selected.table._this)
|
||||
if (selected != null && selected == selected.table.names._this)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class TreeInfo {
|
|||
public static boolean isSelfCall(JCTree tree) {
|
||||
Name name = calledMethodName(tree);
|
||||
if (name != null) {
|
||||
Name.Table names = name.table;
|
||||
Names names = name.table.names;
|
||||
return name==names._this || name==names._super;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -169,7 +169,7 @@ public class TreeInfo {
|
|||
public static boolean isSuperCall(JCTree tree) {
|
||||
Name name = calledMethodName(tree);
|
||||
if (name != null) {
|
||||
Name.Table names = name.table;
|
||||
Names names = name.table.names;
|
||||
return name==names._super;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -183,14 +183,14 @@ public class TreeInfo {
|
|||
JCMethodInvocation app = firstConstructorCall(tree);
|
||||
if (app == null) return false;
|
||||
Name meth = name(app.meth);
|
||||
return meth == null || meth != meth.table._this;
|
||||
return meth == null || meth != meth.table.names._this;
|
||||
}
|
||||
|
||||
/** Return the first call in a constructor definition. */
|
||||
public static JCMethodInvocation firstConstructorCall(JCTree tree) {
|
||||
if (tree.getTag() != JCTree.METHODDEF) return null;
|
||||
JCMethodDecl md = (JCMethodDecl) tree;
|
||||
Name.Table names = md.name.table;
|
||||
Names names = md.name.table.names;
|
||||
if (md.name != names.init) return null;
|
||||
if (md.body == null) return null;
|
||||
List<JCStatement> stats = md.body.stats;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class TreeMaker implements JCTree.Factory {
|
|||
public JCCompilationUnit toplevel;
|
||||
|
||||
/** The current name table. */
|
||||
Name.Table names;
|
||||
Names names;
|
||||
|
||||
Types types;
|
||||
|
||||
|
@ -80,14 +80,14 @@ public class TreeMaker implements JCTree.Factory {
|
|||
context.put(treeMakerKey, this);
|
||||
this.pos = Position.NOPOS;
|
||||
this.toplevel = null;
|
||||
this.names = Name.Table.instance(context);
|
||||
this.names = Names.instance(context);
|
||||
this.syms = Symtab.instance(context);
|
||||
this.types = Types.instance(context);
|
||||
}
|
||||
|
||||
/** Create a tree maker with a given toplevel and FIRSTPOS as initial position.
|
||||
*/
|
||||
TreeMaker(JCCompilationUnit toplevel, Name.Table names, Types types, Symtab syms) {
|
||||
TreeMaker(JCCompilationUnit toplevel, Names names, Types types, Symtab syms) {
|
||||
this.pos = Position.FIRSTPOS;
|
||||
this.toplevel = toplevel;
|
||||
this.names = names;
|
||||
|
|
|
@ -150,7 +150,7 @@ public class ByteBuffer {
|
|||
/** Append a name.
|
||||
*/
|
||||
public void appendName(Name name) {
|
||||
appendBytes(name.table.names, name.index, name.len);
|
||||
appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength());
|
||||
}
|
||||
|
||||
/** Reset to zero length.
|
||||
|
@ -161,7 +161,7 @@ public class ByteBuffer {
|
|||
|
||||
/** Convert contents to name.
|
||||
*/
|
||||
public Name toName(Name.Table names) {
|
||||
public Name toName(Names names) {
|
||||
return names.fromUtf(elems, 0, length);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ public class Convert {
|
|||
*/
|
||||
public static Name shortName(Name classname) {
|
||||
return classname.subName(
|
||||
classname.lastIndexOf((byte)'.') + 1, classname.len);
|
||||
classname.lastIndexOf((byte)'.') + 1, classname.getByteLength());
|
||||
}
|
||||
|
||||
public static String shortName(String classname) {
|
||||
|
|
|
@ -25,246 +25,111 @@
|
|||
|
||||
package com.sun.tools.javac.util;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
|
||||
/** An abstraction for internal compiler strings. For efficiency reasons,
|
||||
* GJC uses hashed strings that are stored in a common large buffer.
|
||||
*
|
||||
* <p>Names represent unique hashable strings. Two names are equal
|
||||
* if their indices are equal. Utf8 representation is used
|
||||
* for storing names internally.
|
||||
/** An abstraction for internal compiler strings. They are stored in
|
||||
* Utf8 format. Names are stored in a Name.Table, and are unique within
|
||||
* that table.
|
||||
*
|
||||
* <p><b>This is NOT part of any API supported by Sun Microsystems. If
|
||||
* you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class Name implements javax.lang.model.element.Name {
|
||||
public abstract class Name implements javax.lang.model.element.Name {
|
||||
|
||||
/** The table structure where the name is stored
|
||||
*/
|
||||
public Table table;
|
||||
public final Table table;
|
||||
|
||||
/** The index where the bytes of this name are stored in the global name
|
||||
* buffer `names'.
|
||||
*/
|
||||
public int index;
|
||||
|
||||
/** The number of bytes in this name.
|
||||
*/
|
||||
public int len;
|
||||
|
||||
/** The next name occupying the same hash bucket.
|
||||
*/
|
||||
Name next;
|
||||
|
||||
/** The hashcode of a name.
|
||||
*/
|
||||
private static int hashValue(byte cs[], int start, int len) {
|
||||
int h = 0;
|
||||
int off = start;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
h = (h << 5) - h + cs[off++];
|
||||
}
|
||||
return h;
|
||||
protected Name(Table table) {
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
/** Is (the utf8 representation of) name equal to
|
||||
* cs[start..start+len-1]?
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
private static boolean equals(byte[] names, int index,
|
||||
byte cs[], int start, int len) {
|
||||
int i = 0;
|
||||
while (i < len && names[index + i] == cs[start + i]) i++;
|
||||
return i == len;
|
||||
public boolean contentEquals(CharSequence cs) {
|
||||
return toString().equals(cs.toString());
|
||||
}
|
||||
|
||||
/** Create a name from the bytes in cs[start..start+len-1].
|
||||
* Assume that bytes are in utf8 format.
|
||||
*/
|
||||
public static Name fromUtf(Table table, byte cs[], int start, int len) {
|
||||
int h = hashValue(cs, start, len) & table.hashMask;
|
||||
Name n = table.hashes[h];
|
||||
byte[] names = table.names;
|
||||
while (n != null &&
|
||||
(n.len != len || !equals(names, n.index, cs, start, len)))
|
||||
n = n.next;
|
||||
if (n == null) {
|
||||
int nc = table.nc;
|
||||
while (nc + len > names.length) {
|
||||
// System.err.println("doubling name buffer of length + " + names.length + " to fit " + len + " bytes");//DEBUG
|
||||
byte[] newnames = new byte[names.length * 2];
|
||||
System.arraycopy(names, 0, newnames, 0, names.length);
|
||||
names = table.names = newnames;
|
||||
}
|
||||
System.arraycopy(cs, start, names, nc, len);
|
||||
n = new Name();
|
||||
n.table = table;
|
||||
n.index = nc;
|
||||
n.len = len;
|
||||
n.next = table.hashes[h];
|
||||
table.hashes[h] = n;
|
||||
table.nc = nc + len;
|
||||
if (len == 0) table.nc++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/** Create a name from the bytes in array cs.
|
||||
* Assume that bytes are in utf8 format.
|
||||
*/
|
||||
public static Name fromUtf(Table table, byte cs[]) {
|
||||
return fromUtf(table, cs, 0, cs.length);
|
||||
}
|
||||
|
||||
/** Create a name from the characters in cs[start..start+len-1].
|
||||
*/
|
||||
public static Name fromChars(Table table, char[] cs, int start, int len) {
|
||||
int nc = table.nc;
|
||||
byte[] names = table.names;
|
||||
while (nc + len * 3 >= names.length) {
|
||||
// System.err.println("doubling name buffer of length " + names.length + " to fit " + len + " chars");//DEBUG
|
||||
byte[] newnames = new byte[names.length * 2];
|
||||
System.arraycopy(names, 0, newnames, 0, names.length);
|
||||
names = table.names = newnames;
|
||||
}
|
||||
int nbytes =
|
||||
Convert.chars2utf(cs, start, names, nc, len) - nc;
|
||||
int h = hashValue(names, nc, nbytes) & table.hashMask;
|
||||
Name n = table.hashes[h];
|
||||
while (n != null &&
|
||||
(n.len != nbytes ||
|
||||
!equals(names, n.index, names, nc, nbytes)))
|
||||
n = n.next;
|
||||
if (n == null) {
|
||||
n = new Name();
|
||||
n.table = table;
|
||||
n.index = nc;
|
||||
n.len = nbytes;
|
||||
n.next = table.hashes[h];
|
||||
table.hashes[h] = n;
|
||||
table.nc = nc + nbytes;
|
||||
if (nbytes == 0) table.nc++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/** Create a name from the characters in string s.
|
||||
*/
|
||||
public static Name fromString(Table table, String s) {
|
||||
char[] cs = s.toCharArray();
|
||||
return fromChars(table, cs, 0, cs.length);
|
||||
}
|
||||
|
||||
/** Create a name from the characters in char sequence s.
|
||||
*/
|
||||
public static Name fromString(Table table, CharSequence s) {
|
||||
return fromString(table, s.toString());
|
||||
}
|
||||
|
||||
/** Return the Utf8 representation of this name.
|
||||
*/
|
||||
public byte[] toUtf() {
|
||||
byte[] bs = new byte[len];
|
||||
System.arraycopy(table.names, index, bs, 0, len);
|
||||
return bs;
|
||||
}
|
||||
|
||||
/** Return the string representation of this name.
|
||||
*/
|
||||
public String toString() {
|
||||
return Convert.utf2string(table.names, index, len);
|
||||
}
|
||||
|
||||
/** Copy all bytes of this name to buffer cs, starting at start.
|
||||
*/
|
||||
public void getBytes(byte cs[], int start) {
|
||||
System.arraycopy(table.names, index, cs, start, len);
|
||||
}
|
||||
|
||||
/** Return the hash value of this name.
|
||||
*/
|
||||
public int hashCode() {
|
||||
return index;
|
||||
}
|
||||
|
||||
/** Is this name equal to other?
|
||||
*/
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof Name)
|
||||
return
|
||||
table == ((Name)other).table && index == ((Name)other).index;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/** Compare this name to other name, yielding -1 if smaller, 0 if equal,
|
||||
* 1 if greater.
|
||||
*/
|
||||
public boolean less(Name that) {
|
||||
int i = 0;
|
||||
while (i < this.len && i < that.len) {
|
||||
byte thisb = this.table.names[this.index + i];
|
||||
byte thatb = that.table.names[that.index + i];
|
||||
if (thisb < thatb) return true;
|
||||
else if (thisb > thatb) return false;
|
||||
else i++;
|
||||
}
|
||||
return this.len < that.len;
|
||||
}
|
||||
|
||||
/** Returns the length of this name.
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public int length() {
|
||||
return toString().length();
|
||||
}
|
||||
|
||||
/** Returns i'th byte of this name.
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public byte byteAt(int i) {
|
||||
return table.names[index + i];
|
||||
public char charAt(int index) {
|
||||
return toString().charAt(index);
|
||||
}
|
||||
|
||||
/** Returns first occurrence of byte b in this name, len if not found.
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public int indexOf(byte b) {
|
||||
byte[] names = table.names;
|
||||
int i = 0;
|
||||
while (i < len && names[index + i] != b) i++;
|
||||
return i;
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
return toString().subSequence(start, end);
|
||||
}
|
||||
|
||||
/** Return the concatenation of this name and name `n'.
|
||||
*/
|
||||
public Name append(Name n) {
|
||||
int len = getByteLength();
|
||||
byte[] bs = new byte[len + n.getByteLength()];
|
||||
getBytes(bs, 0);
|
||||
n.getBytes(bs, len);
|
||||
return table.fromUtf(bs, 0, bs.length);
|
||||
}
|
||||
|
||||
/** Return the concatenation of this name, the given ASCII
|
||||
* character, and name `n'.
|
||||
*/
|
||||
public Name append(char c, Name n) {
|
||||
int len = getByteLength();
|
||||
byte[] bs = new byte[len + 1 + n.getByteLength()];
|
||||
getBytes(bs, 0);
|
||||
bs[len] = (byte) c;
|
||||
n.getBytes(bs, len+1);
|
||||
return table.fromUtf(bs, 0, bs.length);
|
||||
}
|
||||
|
||||
/** An arbitrary but consistent complete order among all Names.
|
||||
*/
|
||||
public int compareTo(Name other) {
|
||||
return other.getIndex() - this.getIndex();
|
||||
}
|
||||
|
||||
/** Return true if this is the empty name.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return getByteLength() == 0;
|
||||
}
|
||||
|
||||
/** Returns last occurrence of byte b in this name, -1 if not found.
|
||||
*/
|
||||
public int lastIndexOf(byte b) {
|
||||
byte[] names = table.names;
|
||||
int i = len - 1;
|
||||
while (i >= 0 && names[index + i] != b) i--;
|
||||
byte[] bytes = getByteArray();
|
||||
int offset = getByteOffset();
|
||||
int i = getByteLength() - 1;
|
||||
while (i >= 0 && bytes[offset + i] != b) i--;
|
||||
return i;
|
||||
}
|
||||
|
||||
/** Does this name start with prefix?
|
||||
*/
|
||||
public boolean startsWith(Name prefix) {
|
||||
int i = 0;
|
||||
while (i < prefix.len &&
|
||||
i < len &&
|
||||
table.names[index + i] == prefix.table.names[prefix.index + i])
|
||||
i++;
|
||||
return i == prefix.len;
|
||||
}
|
||||
byte[] thisBytes = this.getByteArray();
|
||||
int thisOffset = this.getByteOffset();
|
||||
int thisLength = this.getByteLength();
|
||||
byte[] prefixBytes = prefix.getByteArray();
|
||||
int prefixOffset = prefix.getByteOffset();
|
||||
int prefixLength = prefix.getByteLength();
|
||||
|
||||
/** Does this name end with suffix?
|
||||
*/
|
||||
public boolean endsWith(Name suffix) {
|
||||
int i = len - 1;
|
||||
int j = suffix.len - 1;
|
||||
while (j >= 0 && i >= 0 &&
|
||||
table.names[index + i] == suffix.table.names[suffix.index + j]) {
|
||||
i--; j--;
|
||||
}
|
||||
return j < 0;
|
||||
int i = 0;
|
||||
while (i < prefixLength &&
|
||||
i < thisLength &&
|
||||
thisBytes[thisOffset + i] == prefixBytes[prefixOffset + i])
|
||||
i++;
|
||||
return i == prefixLength;
|
||||
}
|
||||
|
||||
/** Returns the sub-name starting at position start, up to and
|
||||
|
@ -272,382 +137,110 @@ public class Name implements javax.lang.model.element.Name {
|
|||
*/
|
||||
public Name subName(int start, int end) {
|
||||
if (end < start) end = start;
|
||||
return fromUtf(table, table.names, index + start, end - start);
|
||||
return table.fromUtf(getByteArray(), getByteOffset() + start, end - start);
|
||||
}
|
||||
|
||||
/** Replace all `from' bytes in this name with `to' bytes.
|
||||
/** Return the string representation of this name.
|
||||
*/
|
||||
public Name replace(byte from, byte to) {
|
||||
byte[] names = table.names;
|
||||
int i = 0;
|
||||
while (i < len) {
|
||||
if (names[index + i] == from) {
|
||||
byte[] bs = new byte[len];
|
||||
System.arraycopy(names, index, bs, 0, i);
|
||||
bs[i] = to;
|
||||
public String toString() {
|
||||
return Convert.utf2string(getByteArray(), getByteOffset(), getByteLength());
|
||||
}
|
||||
|
||||
/** Return the Utf8 representation of this name.
|
||||
*/
|
||||
public byte[] toUtf() {
|
||||
byte[] bs = new byte[getByteLength()];
|
||||
getBytes(bs, 0);
|
||||
return bs;
|
||||
}
|
||||
|
||||
/* Get a "reasonably small" value that uniquely identifies this name
|
||||
* within its name table.
|
||||
*/
|
||||
public abstract int getIndex();
|
||||
|
||||
/** Get the length (in bytes) of this name.
|
||||
*/
|
||||
public abstract int getByteLength();
|
||||
|
||||
/** Returns i'th byte of this name.
|
||||
*/
|
||||
public abstract byte getByteAt(int i);
|
||||
|
||||
/** Copy all bytes of this name to buffer cs, starting at start.
|
||||
*/
|
||||
public void getBytes(byte cs[], int start) {
|
||||
System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength());
|
||||
}
|
||||
|
||||
/** Get the underlying byte array for this name. The contents of the
|
||||
* array must not be modified.
|
||||
*/
|
||||
public abstract byte[] getByteArray();
|
||||
|
||||
/** Get the start offset of this name within its byte array.
|
||||
*/
|
||||
public abstract int getByteOffset();
|
||||
|
||||
/** An abstraction for the hash table used to create unique Name instances.
|
||||
*/
|
||||
public static abstract class Table {
|
||||
/** Standard name table.
|
||||
*/
|
||||
public final Names names;
|
||||
|
||||
Table(Names names) {
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
/** Get the name from the characters in cs[start..start+len-1].
|
||||
*/
|
||||
public abstract Name fromChars(char[] cs, int start, int len);
|
||||
|
||||
/** Get the name for the characters in string s.
|
||||
*/
|
||||
public Name fromString(String s) {
|
||||
char[] cs = s.toCharArray();
|
||||
return fromChars(cs, 0, cs.length);
|
||||
}
|
||||
|
||||
/** Get the name for the bytes in array cs.
|
||||
* Assume that bytes are in utf8 format.
|
||||
*/
|
||||
public Name fromUtf(byte[] cs) {
|
||||
return fromUtf(cs, 0, cs.length);
|
||||
}
|
||||
|
||||
/** get the name for the bytes in cs[start..start+len-1].
|
||||
* Assume that bytes are in utf8 format.
|
||||
*/
|
||||
public abstract Name fromUtf(byte[] cs, int start, int len);
|
||||
|
||||
/** Release any resources used by this table.
|
||||
*/
|
||||
public abstract void dispose();
|
||||
|
||||
/** The hashcode of a name.
|
||||
*/
|
||||
protected static int hashValue(byte bytes[], int offset, int length) {
|
||||
int h = 0;
|
||||
int off = offset;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
h = (h << 5) - h + bytes[off++];
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
/** Compare two subarrays
|
||||
*/
|
||||
protected static boolean equals(byte[] bytes1, int offset1,
|
||||
byte[] bytes2, int offset2, int length) {
|
||||
int i = 0;
|
||||
while (i < length && bytes1[offset1 + i] == bytes2[offset2 + i]) {
|
||||
i++;
|
||||
while (i < len) {
|
||||
byte b = names[index + i];
|
||||
bs[i] = b == from ? to : b;
|
||||
i++;
|
||||
}
|
||||
return fromUtf(table, bs, 0, len);
|
||||
}
|
||||
i++;
|
||||
return i == length;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Return the concatenation of this name and name `n'.
|
||||
*/
|
||||
public Name append(Name n) {
|
||||
byte[] bs = new byte[len + n.len];
|
||||
getBytes(bs, 0);
|
||||
n.getBytes(bs, len);
|
||||
return fromUtf(table, bs, 0, bs.length);
|
||||
}
|
||||
|
||||
/** Return the concatenation of this name, the given ASCII
|
||||
* character, and name `n'.
|
||||
*/
|
||||
public Name append(char c, Name n) {
|
||||
byte[] bs = new byte[len + n.len + 1];
|
||||
getBytes(bs, 0);
|
||||
bs[len] = (byte)c;
|
||||
n.getBytes(bs, len+1);
|
||||
return fromUtf(table, bs, 0, bs.length);
|
||||
}
|
||||
|
||||
/** An arbitrary but consistent complete order among all Names.
|
||||
*/
|
||||
public int compareTo(Name other) {
|
||||
return other.index - this.index;
|
||||
}
|
||||
|
||||
/** Return the concatenation of all names in the array `ns'.
|
||||
*/
|
||||
public static Name concat(Table table, Name ns[]) {
|
||||
int len = 0;
|
||||
for (int i = 0; i < ns.length; i++)
|
||||
len = len + ns[i].len;
|
||||
byte[] bs = new byte[len];
|
||||
len = 0;
|
||||
for (int i = 0; i < ns.length; i++) {
|
||||
ns[i].getBytes(bs, len);
|
||||
len = len + ns[i].len;
|
||||
}
|
||||
return fromUtf(table, bs, 0, len);
|
||||
}
|
||||
|
||||
public char charAt(int index) {
|
||||
return toString().charAt(index);
|
||||
}
|
||||
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
return toString().subSequence(start, end);
|
||||
}
|
||||
|
||||
public boolean contentEquals(CharSequence cs) {
|
||||
return this.toString().equals(cs.toString());
|
||||
}
|
||||
|
||||
public static class Table {
|
||||
// maintain a freelist of recently used name tables for reuse.
|
||||
private static List<SoftReference<Table>> freelist = List.nil();
|
||||
|
||||
static private synchronized Table make() {
|
||||
while (freelist.nonEmpty()) {
|
||||
Table t = freelist.head.get();
|
||||
freelist = freelist.tail;
|
||||
if (t != null) return t;
|
||||
}
|
||||
return new Table();
|
||||
}
|
||||
|
||||
static private synchronized void dispose(Table t) {
|
||||
freelist = freelist.prepend(new SoftReference<Table>(t));
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
dispose(this);
|
||||
}
|
||||
|
||||
public static final Context.Key<Table> namesKey =
|
||||
new Context.Key<Table>();
|
||||
|
||||
public static Table instance(Context context) {
|
||||
Table instance = context.get(namesKey);
|
||||
if (instance == null) {
|
||||
instance = make();
|
||||
context.put(namesKey, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** The hash table for names.
|
||||
*/
|
||||
private Name[] hashes;
|
||||
|
||||
/** The array holding all encountered names.
|
||||
*/
|
||||
public byte[] names;
|
||||
|
||||
/** The mask to be used for hashing
|
||||
*/
|
||||
private int hashMask;
|
||||
|
||||
/** The number of filled bytes in `names'.
|
||||
*/
|
||||
private int nc = 0;
|
||||
|
||||
/** Allocator
|
||||
* @param hashSize the (constant) size to be used for the hash table
|
||||
* needs to be a power of two.
|
||||
* @param nameSize the initial size of the name table.
|
||||
*/
|
||||
public Table(int hashSize, int nameSize) {
|
||||
hashMask = hashSize - 1;
|
||||
hashes = new Name[hashSize];
|
||||
names = new byte[nameSize];
|
||||
|
||||
slash = fromString("/");
|
||||
hyphen = fromString("-");
|
||||
T = fromString("T");
|
||||
slashequals = fromString("/=");
|
||||
deprecated = fromString("deprecated");
|
||||
|
||||
init = fromString("<init>");
|
||||
clinit = fromString("<clinit>");
|
||||
error = fromString("<error>");
|
||||
any = fromString("<any>");
|
||||
empty = fromString("");
|
||||
one = fromString("1");
|
||||
period = fromString(".");
|
||||
comma = fromString(",");
|
||||
semicolon = fromString(";");
|
||||
asterisk = fromString("*");
|
||||
_this = fromString("this");
|
||||
_super = fromString("super");
|
||||
_default = fromString("default");
|
||||
|
||||
_class = fromString("class");
|
||||
java_lang = fromString("java.lang");
|
||||
java_lang_Object = fromString("java.lang.Object");
|
||||
java_lang_Class = fromString("java.lang.Class");
|
||||
java_lang_Cloneable = fromString("java.lang.Cloneable");
|
||||
java_io_Serializable = fromString("java.io.Serializable");
|
||||
java_lang_Enum = fromString("java.lang.Enum");
|
||||
package_info = fromString("package-info");
|
||||
serialVersionUID = fromString("serialVersionUID");
|
||||
ConstantValue = fromString("ConstantValue");
|
||||
LineNumberTable = fromString("LineNumberTable");
|
||||
LocalVariableTable = fromString("LocalVariableTable");
|
||||
LocalVariableTypeTable = fromString("LocalVariableTypeTable");
|
||||
CharacterRangeTable = fromString("CharacterRangeTable");
|
||||
StackMap = fromString("StackMap");
|
||||
StackMapTable = fromString("StackMapTable");
|
||||
SourceID = fromString("SourceID");
|
||||
CompilationID = fromString("CompilationID");
|
||||
Code = fromString("Code");
|
||||
Exceptions = fromString("Exceptions");
|
||||
SourceFile = fromString("SourceFile");
|
||||
InnerClasses = fromString("InnerClasses");
|
||||
Synthetic = fromString("Synthetic");
|
||||
Bridge= fromString("Bridge");
|
||||
Deprecated = fromString("Deprecated");
|
||||
Enum = fromString("Enum");
|
||||
_name = fromString("name");
|
||||
Signature = fromString("Signature");
|
||||
Varargs = fromString("Varargs");
|
||||
Annotation = fromString("Annotation");
|
||||
RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
|
||||
RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
|
||||
RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
|
||||
RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
|
||||
Value = fromString("Value");
|
||||
EnclosingMethod = fromString("EnclosingMethod");
|
||||
|
||||
desiredAssertionStatus = fromString("desiredAssertionStatus");
|
||||
|
||||
append = fromString("append");
|
||||
family = fromString("family");
|
||||
forName = fromString("forName");
|
||||
toString = fromString("toString");
|
||||
length = fromString("length");
|
||||
valueOf = fromString("valueOf");
|
||||
value = fromString("value");
|
||||
getMessage = fromString("getMessage");
|
||||
getClass = fromString("getClass");
|
||||
|
||||
TYPE = fromString("TYPE");
|
||||
FIELD = fromString("FIELD");
|
||||
METHOD = fromString("METHOD");
|
||||
PARAMETER = fromString("PARAMETER");
|
||||
CONSTRUCTOR = fromString("CONSTRUCTOR");
|
||||
LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
|
||||
ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
|
||||
PACKAGE = fromString("PACKAGE");
|
||||
|
||||
SOURCE = fromString("SOURCE");
|
||||
CLASS = fromString("CLASS");
|
||||
RUNTIME = fromString("RUNTIME");
|
||||
|
||||
Array = fromString("Array");
|
||||
Method = fromString("Method");
|
||||
Bound = fromString("Bound");
|
||||
clone = fromString("clone");
|
||||
getComponentType = fromString("getComponentType");
|
||||
getClassLoader = fromString("getClassLoader");
|
||||
initCause = fromString("initCause");
|
||||
values = fromString("values");
|
||||
iterator = fromString("iterator");
|
||||
hasNext = fromString("hasNext");
|
||||
next = fromString("next");
|
||||
AnnotationDefault = fromString("AnnotationDefault");
|
||||
ordinal = fromString("ordinal");
|
||||
equals = fromString("equals");
|
||||
hashCode = fromString("hashCode");
|
||||
compareTo = fromString("compareTo");
|
||||
getDeclaringClass = fromString("getDeclaringClass");
|
||||
ex = fromString("ex");
|
||||
finalize = fromString("finalize");
|
||||
}
|
||||
|
||||
public Table() {
|
||||
this(0x8000, 0x20000);
|
||||
}
|
||||
|
||||
/** Create a name from the bytes in cs[start..start+len-1].
|
||||
* Assume that bytes are in utf8 format.
|
||||
*/
|
||||
public Name fromUtf(byte cs[], int start, int len) {
|
||||
return Name.fromUtf(this, cs, start, len);
|
||||
}
|
||||
|
||||
/** Create a name from the bytes in array cs.
|
||||
* Assume that bytes are in utf8 format.
|
||||
*/
|
||||
public Name fromUtf(byte cs[]) {
|
||||
return Name.fromUtf(this, cs, 0, cs.length);
|
||||
}
|
||||
|
||||
/** Create a name from the characters in cs[start..start+len-1].
|
||||
*/
|
||||
public Name fromChars(char[] cs, int start, int len) {
|
||||
return Name.fromChars(this, cs, start, len);
|
||||
}
|
||||
|
||||
/** Create a name from the characters in string s.
|
||||
*/
|
||||
public Name fromString(CharSequence s) {
|
||||
return Name.fromString(this, s);
|
||||
}
|
||||
|
||||
public final Name slash;
|
||||
public final Name hyphen;
|
||||
public final Name T;
|
||||
public final Name slashequals;
|
||||
public final Name deprecated;
|
||||
|
||||
public final Name init;
|
||||
public final Name clinit;
|
||||
public final Name error;
|
||||
public final Name any;
|
||||
public final Name empty;
|
||||
public final Name one;
|
||||
public final Name period;
|
||||
public final Name comma;
|
||||
public final Name semicolon;
|
||||
public final Name asterisk;
|
||||
public final Name _this;
|
||||
public final Name _super;
|
||||
public final Name _default;
|
||||
|
||||
public final Name _class;
|
||||
public final Name java_lang;
|
||||
public final Name java_lang_Object;
|
||||
public final Name java_lang_Class;
|
||||
public final Name java_lang_Cloneable;
|
||||
public final Name java_io_Serializable;
|
||||
public final Name serialVersionUID;
|
||||
public final Name java_lang_Enum;
|
||||
public final Name package_info;
|
||||
public final Name ConstantValue;
|
||||
public final Name LineNumberTable;
|
||||
public final Name LocalVariableTable;
|
||||
public final Name LocalVariableTypeTable;
|
||||
public final Name CharacterRangeTable;
|
||||
public final Name StackMap;
|
||||
public final Name StackMapTable;
|
||||
public final Name SourceID;
|
||||
public final Name CompilationID;
|
||||
public final Name Code;
|
||||
public final Name Exceptions;
|
||||
public final Name SourceFile;
|
||||
public final Name InnerClasses;
|
||||
public final Name Synthetic;
|
||||
public final Name Bridge;
|
||||
public final Name Deprecated;
|
||||
public final Name Enum;
|
||||
public final Name _name;
|
||||
public final Name Signature;
|
||||
public final Name Varargs;
|
||||
public final Name Annotation;
|
||||
public final Name RuntimeVisibleAnnotations;
|
||||
public final Name RuntimeInvisibleAnnotations;
|
||||
public final Name RuntimeVisibleParameterAnnotations;
|
||||
public final Name RuntimeInvisibleParameterAnnotations;
|
||||
|
||||
public final Name Value;
|
||||
public final Name EnclosingMethod;
|
||||
|
||||
public final Name desiredAssertionStatus;
|
||||
|
||||
public final Name append;
|
||||
public final Name family;
|
||||
public final Name forName;
|
||||
public final Name toString;
|
||||
public final Name length;
|
||||
public final Name valueOf;
|
||||
public final Name value;
|
||||
public final Name getMessage;
|
||||
public final Name getClass;
|
||||
|
||||
public final Name TYPE;
|
||||
public final Name FIELD;
|
||||
public final Name METHOD;
|
||||
public final Name PARAMETER;
|
||||
public final Name CONSTRUCTOR;
|
||||
public final Name LOCAL_VARIABLE;
|
||||
public final Name ANNOTATION_TYPE;
|
||||
public final Name PACKAGE;
|
||||
|
||||
public final Name SOURCE;
|
||||
public final Name CLASS;
|
||||
public final Name RUNTIME;
|
||||
|
||||
public final Name Array;
|
||||
public final Name Method;
|
||||
public final Name Bound;
|
||||
public final Name clone;
|
||||
public final Name getComponentType;
|
||||
public final Name getClassLoader;
|
||||
public final Name initCause;
|
||||
public final Name values;
|
||||
public final Name iterator;
|
||||
public final Name hasNext;
|
||||
public final Name next;
|
||||
public final Name AnnotationDefault;
|
||||
public final Name ordinal;
|
||||
public final Name equals;
|
||||
public final Name hashCode;
|
||||
public final Name compareTo;
|
||||
public final Name getDeclaringClass;
|
||||
public final Name ex;
|
||||
public final Name finalize;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return len == 0;
|
||||
}
|
||||
}
|
||||
|
|
281
langtools/src/share/classes/com/sun/tools/javac/util/Names.java
Normal file
281
langtools/src/share/classes/com/sun/tools/javac/util/Names.java
Normal file
|
@ -0,0 +1,281 @@
|
|||
/*
|
||||
* Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.javac.util;
|
||||
|
||||
/**
|
||||
* Access to the compiler's name table. STandard names are defined,
|
||||
* as well as methods to create new names.
|
||||
*
|
||||
* <p><b>This is NOT part of any API supported by Sun Microsystems. If
|
||||
* you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class Names {
|
||||
|
||||
public static final Context.Key<Names> namesKey = new Context.Key<Names>();
|
||||
|
||||
public static Names instance(Context context) {
|
||||
Names instance = context.get(namesKey);
|
||||
if (instance == null) {
|
||||
instance = new Names(context);
|
||||
context.put(namesKey, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public final Name slash;
|
||||
public final Name hyphen;
|
||||
public final Name T;
|
||||
public final Name slashequals;
|
||||
public final Name deprecated;
|
||||
public final Name init;
|
||||
public final Name clinit;
|
||||
public final Name error;
|
||||
public final Name any;
|
||||
public final Name empty;
|
||||
public final Name one;
|
||||
public final Name period;
|
||||
public final Name comma;
|
||||
public final Name semicolon;
|
||||
public final Name asterisk;
|
||||
public final Name _this;
|
||||
public final Name _super;
|
||||
public final Name _default;
|
||||
public final Name _class;
|
||||
public final Name java_lang;
|
||||
public final Name java_lang_Object;
|
||||
public final Name java_lang_Class;
|
||||
public final Name java_lang_Cloneable;
|
||||
public final Name java_io_Serializable;
|
||||
public final Name serialVersionUID;
|
||||
public final Name java_lang_Enum;
|
||||
public final Name package_info;
|
||||
public final Name ConstantValue;
|
||||
public final Name LineNumberTable;
|
||||
public final Name LocalVariableTable;
|
||||
public final Name LocalVariableTypeTable;
|
||||
public final Name CharacterRangeTable;
|
||||
public final Name StackMap;
|
||||
public final Name StackMapTable;
|
||||
public final Name SourceID;
|
||||
public final Name CompilationID;
|
||||
public final Name Code;
|
||||
public final Name Exceptions;
|
||||
public final Name SourceFile;
|
||||
public final Name InnerClasses;
|
||||
public final Name Synthetic;
|
||||
public final Name Bridge;
|
||||
public final Name Deprecated;
|
||||
public final Name Enum;
|
||||
public final Name _name;
|
||||
public final Name Signature;
|
||||
public final Name Varargs;
|
||||
public final Name Annotation;
|
||||
public final Name RuntimeVisibleAnnotations;
|
||||
public final Name RuntimeInvisibleAnnotations;
|
||||
public final Name RuntimeVisibleParameterAnnotations;
|
||||
public final Name RuntimeInvisibleParameterAnnotations;
|
||||
public final Name Value;
|
||||
public final Name EnclosingMethod;
|
||||
public final Name desiredAssertionStatus;
|
||||
public final Name append;
|
||||
public final Name family;
|
||||
public final Name forName;
|
||||
public final Name toString;
|
||||
public final Name length;
|
||||
public final Name valueOf;
|
||||
public final Name value;
|
||||
public final Name getMessage;
|
||||
public final Name getClass;
|
||||
public final Name TYPE;
|
||||
public final Name FIELD;
|
||||
public final Name METHOD;
|
||||
public final Name PARAMETER;
|
||||
public final Name CONSTRUCTOR;
|
||||
public final Name LOCAL_VARIABLE;
|
||||
public final Name ANNOTATION_TYPE;
|
||||
public final Name PACKAGE;
|
||||
public final Name SOURCE;
|
||||
public final Name CLASS;
|
||||
public final Name RUNTIME;
|
||||
public final Name Array;
|
||||
public final Name Method;
|
||||
public final Name Bound;
|
||||
public final Name clone;
|
||||
public final Name getComponentType;
|
||||
public final Name getClassLoader;
|
||||
public final Name initCause;
|
||||
public final Name values;
|
||||
public final Name iterator;
|
||||
public final Name hasNext;
|
||||
public final Name next;
|
||||
public final Name AnnotationDefault;
|
||||
public final Name ordinal;
|
||||
public final Name equals;
|
||||
public final Name hashCode;
|
||||
public final Name compareTo;
|
||||
public final Name getDeclaringClass;
|
||||
public final Name ex;
|
||||
public final Name finalize;
|
||||
|
||||
public final Name.Table table;
|
||||
|
||||
public Names(Context context) {
|
||||
Options options = Options.instance(context);
|
||||
table = createTable(options);
|
||||
|
||||
slash = fromString("/");
|
||||
hyphen = fromString("-");
|
||||
T = fromString("T");
|
||||
slashequals = fromString("/=");
|
||||
deprecated = fromString("deprecated");
|
||||
|
||||
init = fromString("<init>");
|
||||
clinit = fromString("<clinit>");
|
||||
error = fromString("<error>");
|
||||
any = fromString("<any>");
|
||||
empty = fromString("");
|
||||
one = fromString("1");
|
||||
period = fromString(".");
|
||||
comma = fromString(",");
|
||||
semicolon = fromString(";");
|
||||
asterisk = fromString("*");
|
||||
_this = fromString("this");
|
||||
_super = fromString("super");
|
||||
_default = fromString("default");
|
||||
|
||||
_class = fromString("class");
|
||||
java_lang = fromString("java.lang");
|
||||
java_lang_Object = fromString("java.lang.Object");
|
||||
java_lang_Class = fromString("java.lang.Class");
|
||||
java_lang_Cloneable = fromString("java.lang.Cloneable");
|
||||
java_io_Serializable = fromString("java.io.Serializable");
|
||||
java_lang_Enum = fromString("java.lang.Enum");
|
||||
package_info = fromString("package-info");
|
||||
serialVersionUID = fromString("serialVersionUID");
|
||||
ConstantValue = fromString("ConstantValue");
|
||||
LineNumberTable = fromString("LineNumberTable");
|
||||
LocalVariableTable = fromString("LocalVariableTable");
|
||||
LocalVariableTypeTable = fromString("LocalVariableTypeTable");
|
||||
CharacterRangeTable = fromString("CharacterRangeTable");
|
||||
StackMap = fromString("StackMap");
|
||||
StackMapTable = fromString("StackMapTable");
|
||||
SourceID = fromString("SourceID");
|
||||
CompilationID = fromString("CompilationID");
|
||||
Code = fromString("Code");
|
||||
Exceptions = fromString("Exceptions");
|
||||
SourceFile = fromString("SourceFile");
|
||||
InnerClasses = fromString("InnerClasses");
|
||||
Synthetic = fromString("Synthetic");
|
||||
Bridge = fromString("Bridge");
|
||||
Deprecated = fromString("Deprecated");
|
||||
Enum = fromString("Enum");
|
||||
_name = fromString("name");
|
||||
Signature = fromString("Signature");
|
||||
Varargs = fromString("Varargs");
|
||||
Annotation = fromString("Annotation");
|
||||
RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
|
||||
RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
|
||||
RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
|
||||
RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
|
||||
Value = fromString("Value");
|
||||
EnclosingMethod = fromString("EnclosingMethod");
|
||||
|
||||
desiredAssertionStatus = fromString("desiredAssertionStatus");
|
||||
|
||||
append = fromString("append");
|
||||
family = fromString("family");
|
||||
forName = fromString("forName");
|
||||
toString = fromString("toString");
|
||||
length = fromString("length");
|
||||
valueOf = fromString("valueOf");
|
||||
value = fromString("value");
|
||||
getMessage = fromString("getMessage");
|
||||
getClass = fromString("getClass");
|
||||
|
||||
TYPE = fromString("TYPE");
|
||||
FIELD = fromString("FIELD");
|
||||
METHOD = fromString("METHOD");
|
||||
PARAMETER = fromString("PARAMETER");
|
||||
CONSTRUCTOR = fromString("CONSTRUCTOR");
|
||||
LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
|
||||
ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
|
||||
PACKAGE = fromString("PACKAGE");
|
||||
|
||||
SOURCE = fromString("SOURCE");
|
||||
CLASS = fromString("CLASS");
|
||||
RUNTIME = fromString("RUNTIME");
|
||||
|
||||
Array = fromString("Array");
|
||||
Method = fromString("Method");
|
||||
Bound = fromString("Bound");
|
||||
clone = fromString("clone");
|
||||
getComponentType = fromString("getComponentType");
|
||||
getClassLoader = fromString("getClassLoader");
|
||||
initCause = fromString("initCause");
|
||||
values = fromString("values");
|
||||
iterator = fromString("iterator");
|
||||
hasNext = fromString("hasNext");
|
||||
next = fromString("next");
|
||||
AnnotationDefault = fromString("AnnotationDefault");
|
||||
ordinal = fromString("ordinal");
|
||||
equals = fromString("equals");
|
||||
hashCode = fromString("hashCode");
|
||||
compareTo = fromString("compareTo");
|
||||
getDeclaringClass = fromString("getDeclaringClass");
|
||||
ex = fromString("ex");
|
||||
finalize = fromString("finalize");
|
||||
}
|
||||
|
||||
protected Name.Table createTable(Options options) {
|
||||
boolean useUnsharedTable = options.get("useUnsharedTable") != null;
|
||||
if (useUnsharedTable)
|
||||
return new UnsharedNameTable(this);
|
||||
else
|
||||
return new SharedNameTable(this);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
table.dispose();
|
||||
}
|
||||
|
||||
public Name fromChars(char[] cs, int start, int len) {
|
||||
return table.fromChars(cs, start, len);
|
||||
}
|
||||
|
||||
public Name fromString(String s) {
|
||||
return table.fromString(s);
|
||||
}
|
||||
|
||||
public Name fromUtf(byte[] cs) {
|
||||
return table.fromUtf(cs);
|
||||
}
|
||||
|
||||
public Name fromUtf(byte[] cs, int start, int len) {
|
||||
return table.fromUtf(cs, start, len);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.javac.util;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
/**
|
||||
* Implementation of Name.Table that stores all names in a single shared
|
||||
* byte array, expanding it as needed. This avoids the overhead incurred
|
||||
* by using an array of bytes for each name.
|
||||
*
|
||||
* <p><b>This is NOT part of any API supported by Sun Microsystems. If
|
||||
* you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class SharedNameTable extends Name.Table {
|
||||
// maintain a freelist of recently used name tables for reuse.
|
||||
private static List<SoftReference<SharedNameTable>> freelist = List.nil();
|
||||
|
||||
static public synchronized SharedNameTable create(Names names) {
|
||||
while (freelist.nonEmpty()) {
|
||||
SharedNameTable t = freelist.head.get();
|
||||
freelist = freelist.tail;
|
||||
if (t != null) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return new SharedNameTable(names);
|
||||
}
|
||||
|
||||
static private synchronized void dispose(SharedNameTable t) {
|
||||
freelist = freelist.prepend(new SoftReference<SharedNameTable>(t));
|
||||
}
|
||||
|
||||
/** The hash table for names.
|
||||
*/
|
||||
private NameImpl[] hashes;
|
||||
|
||||
/** The shared byte array holding all encountered names.
|
||||
*/
|
||||
public byte[] bytes;
|
||||
|
||||
/** The mask to be used for hashing
|
||||
*/
|
||||
private int hashMask;
|
||||
|
||||
/** The number of filled bytes in `names'.
|
||||
*/
|
||||
private int nc = 0;
|
||||
|
||||
/** Allocator
|
||||
* @param names The main name table
|
||||
* @param hashSize the (constant) size to be used for the hash table
|
||||
* needs to be a power of two.
|
||||
* @param nameSize the initial size of the name table.
|
||||
*/
|
||||
public SharedNameTable(Names names, int hashSize, int nameSize) {
|
||||
super(names);
|
||||
hashMask = hashSize - 1;
|
||||
hashes = new NameImpl[hashSize];
|
||||
bytes = new byte[nameSize];
|
||||
|
||||
}
|
||||
|
||||
public SharedNameTable(Names names) {
|
||||
this(names, 0x8000, 0x20000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name fromChars(char[] cs, int start, int len) {
|
||||
int nc = this.nc;
|
||||
byte[] bytes = this.bytes;
|
||||
while (nc + len * 3 >= bytes.length) {
|
||||
// System.err.println("doubling name buffer of length " + names.length + " to fit " + len + " chars");//DEBUG
|
||||
byte[] newnames = new byte[bytes.length * 2];
|
||||
System.arraycopy(bytes, 0, newnames, 0, bytes.length);
|
||||
bytes = this.bytes = newnames;
|
||||
}
|
||||
int nbytes = Convert.chars2utf(cs, start, bytes, nc, len) - nc;
|
||||
int h = hashValue(bytes, nc, nbytes) & hashMask;
|
||||
NameImpl n = hashes[h];
|
||||
while (n != null &&
|
||||
(n.getByteLength() != nbytes ||
|
||||
!equals(bytes, n.index, bytes, nc, nbytes))) {
|
||||
n = n.next;
|
||||
}
|
||||
if (n == null) {
|
||||
n = new NameImpl(this);
|
||||
n.index = nc;
|
||||
n.length = nbytes;
|
||||
n.next = hashes[h];
|
||||
hashes[h] = n;
|
||||
this.nc = nc + nbytes;
|
||||
if (nbytes == 0) {
|
||||
this.nc++;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name fromUtf(byte[] cs, int start, int len) {
|
||||
int h = hashValue(cs, start, len) & hashMask;
|
||||
NameImpl n = hashes[h];
|
||||
byte[] names = this.bytes;
|
||||
while (n != null &&
|
||||
(n.getByteLength() != len || !equals(names, n.index, cs, start, len))) {
|
||||
n = n.next;
|
||||
}
|
||||
if (n == null) {
|
||||
int nc = this.nc;
|
||||
while (nc + len > names.length) {
|
||||
// System.err.println("doubling name buffer of length + " + names.length + " to fit " + len + " bytes");//DEBUG
|
||||
byte[] newnames = new byte[names.length * 2];
|
||||
System.arraycopy(names, 0, newnames, 0, names.length);
|
||||
names = this.bytes = newnames;
|
||||
}
|
||||
System.arraycopy(cs, start, names, nc, len);
|
||||
n = new NameImpl(this);
|
||||
n.index = nc;
|
||||
n.length = len;
|
||||
n.next = hashes[h];
|
||||
hashes[h] = n;
|
||||
this.nc = nc + len;
|
||||
if (len == 0) {
|
||||
this.nc++;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
dispose(this);
|
||||
}
|
||||
|
||||
static class NameImpl extends Name {
|
||||
/** The next name occupying the same hash bucket.
|
||||
*/
|
||||
NameImpl next;
|
||||
|
||||
/** The index where the bytes of this name are stored in the global name
|
||||
* buffer `byte'.
|
||||
*/
|
||||
int index;
|
||||
|
||||
/** The number of bytes in this name.
|
||||
*/
|
||||
int length;
|
||||
|
||||
NameImpl(SharedNameTable table) {
|
||||
super(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getByteAt(int i) {
|
||||
return getByteArray()[index + i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getByteArray() {
|
||||
return ((SharedNameTable) table).bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteOffset() {
|
||||
return index;
|
||||
}
|
||||
|
||||
/** Return the hash value of this name.
|
||||
*/
|
||||
public int hashCode() {
|
||||
return index;
|
||||
}
|
||||
|
||||
/** Is this name equal to other?
|
||||
*/
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof Name)
|
||||
return
|
||||
table == ((Name)other).table && index == ((Name) other).getIndex();
|
||||
else return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.javac.util;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Implementation of Name.Table that stores names in individual arrays
|
||||
* using weak references. It is recommended for use when a single shared
|
||||
* byte array is unsuitable.
|
||||
*
|
||||
* <p><b>This is NOT part of any API supported by Sun Microsystems. If
|
||||
* you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class UnsharedNameTable extends Name.Table {
|
||||
static public Name.Table create(Names names) {
|
||||
return new UnsharedNameTable(names);
|
||||
}
|
||||
|
||||
static class HashEntry extends WeakReference<NameImpl> {
|
||||
HashEntry next;
|
||||
HashEntry(NameImpl referent) {
|
||||
super(referent);
|
||||
}
|
||||
}
|
||||
|
||||
/** The hash table for names.
|
||||
*/
|
||||
private HashEntry[] hashes = null;
|
||||
|
||||
/** The mask to be used for hashing
|
||||
*/
|
||||
private int hashMask;
|
||||
|
||||
/** Index counter for names in this table.
|
||||
*/
|
||||
public int index;
|
||||
|
||||
/** Allocator
|
||||
* @param names The main name table
|
||||
* @param hashSize the (constant) size to be used for the hash table
|
||||
* needs to be a power of two.
|
||||
*/
|
||||
public UnsharedNameTable(Names names, int hashSize) {
|
||||
super(names);
|
||||
hashMask = hashSize - 1;
|
||||
hashes = new HashEntry[hashSize];
|
||||
}
|
||||
|
||||
public UnsharedNameTable(Names names) {
|
||||
this(names, 0x8000);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Name fromChars(char[] cs, int start, int len) {
|
||||
byte[] name = new byte[len * 3];
|
||||
int nbytes = Convert.chars2utf(cs, start, name, 0, len);
|
||||
return fromUtf(name, 0, nbytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name fromUtf(byte[] cs, int start, int len) {
|
||||
int h = hashValue(cs, start, len) & hashMask;
|
||||
|
||||
HashEntry element = hashes[h];
|
||||
|
||||
NameImpl n = null;
|
||||
|
||||
HashEntry previousNonNullTableEntry = null;
|
||||
HashEntry firstTableEntry = element;
|
||||
|
||||
while (element != null) {
|
||||
if (element == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
n = element.get();
|
||||
|
||||
if (n == null) {
|
||||
if (firstTableEntry == element) {
|
||||
hashes[h] = firstTableEntry = element.next;
|
||||
}
|
||||
else {
|
||||
assert previousNonNullTableEntry != null : "previousNonNullTableEntry cannot be null here.";
|
||||
previousNonNullTableEntry.next = element.next;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (n.getByteLength() == len && equals(n.bytes, 0, cs, start, len)) {
|
||||
return n;
|
||||
}
|
||||
previousNonNullTableEntry = element;
|
||||
}
|
||||
|
||||
element = element.next;
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[len];
|
||||
System.arraycopy(cs, start, bytes, 0, len);
|
||||
n = new NameImpl(this, bytes, index++);
|
||||
|
||||
System.arraycopy(cs, start, n.bytes, 0, len);
|
||||
|
||||
HashEntry newEntry = new HashEntry(n);
|
||||
|
||||
if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
|
||||
hashes[h] = newEntry;
|
||||
}
|
||||
else {
|
||||
assert previousNonNullTableEntry.next == null : "previousNonNullTableEntry.next must be null.";
|
||||
previousNonNullTableEntry.next = newEntry;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
hashes = null;
|
||||
}
|
||||
|
||||
static class NameImpl extends Name {
|
||||
NameImpl(UnsharedNameTable table, byte[] bytes, int index) {
|
||||
super(table);
|
||||
this.bytes = bytes;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
final byte[] bytes;
|
||||
final int index;
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteLength() {
|
||||
return bytes.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getByteAt(int i) {
|
||||
return bytes[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getByteArray() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -27,17 +27,13 @@ package com.sun.tools.javadoc;
|
|||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
import static com.sun.javadoc.LanguageVersion.*;
|
||||
|
||||
import com.sun.tools.javac.code.Flags;
|
||||
import com.sun.tools.javac.code.Kinds;
|
||||
import com.sun.tools.javac.code.Scope;
|
||||
import com.sun.tools.javac.code.Symbol;
|
||||
import com.sun.tools.javac.code.Symbol.*;
|
||||
import com.sun.tools.javac.tree.JCTree.*;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import com.sun.tools.javac.util.Position;
|
||||
|
||||
/**
|
||||
|
@ -93,7 +89,7 @@ public class AnnotationTypeDocImpl
|
|||
* Elements are always public, so no need to filter them.
|
||||
*/
|
||||
public AnnotationTypeElementDoc[] elements() {
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
List<AnnotationTypeElementDoc> elements = List.nil();
|
||||
for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
|
||||
if (e.sym != null && e.sym.kind == Kinds.MTH) {
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
package com.sun.tools.javadoc;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
import static com.sun.javadoc.LanguageVersion.*;
|
||||
|
@ -40,7 +38,6 @@ import com.sun.tools.javac.code.Flags;
|
|||
import com.sun.tools.javac.code.Kinds;
|
||||
import com.sun.tools.javac.code.TypeTags;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Types;
|
||||
import com.sun.tools.javac.code.Type.ClassType;
|
||||
import com.sun.tools.javac.code.Scope;
|
||||
import com.sun.tools.javac.code.Symbol;
|
||||
|
@ -55,9 +52,9 @@ import com.sun.tools.javac.tree.JCTree.JCImport;
|
|||
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
|
||||
import com.sun.tools.javac.tree.TreeInfo;
|
||||
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import static com.sun.tools.javac.code.Flags.*;
|
||||
import static com.sun.tools.javac.code.Kinds.*;
|
||||
import static com.sun.tools.javac.code.TypeTags.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
@ -549,7 +546,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
* methods in this class. Does not include constructors.
|
||||
*/
|
||||
public MethodDoc[] methods(boolean filter) {
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
List<MethodDocImpl> methods = List.nil();
|
||||
for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
|
||||
if (e.sym != null &&
|
||||
|
@ -582,7 +579,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
* constructors in this class.
|
||||
*/
|
||||
public ConstructorDoc[] constructors(boolean filter) {
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
List<ConstructorDocImpl> constructors = List.nil();
|
||||
for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
|
||||
if (e.sym != null &&
|
||||
|
@ -696,7 +693,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
}
|
||||
|
||||
private ClassDoc searchClass(String className) {
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
|
||||
// search by qualified name first
|
||||
ClassDoc cd = env.lookupClass(className);
|
||||
|
@ -848,7 +845,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
*---------------------------------*/
|
||||
|
||||
// search current class
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
Scope.Entry e = tsym.members().lookup(names.fromString(methodName));
|
||||
|
||||
//### Using modifier filter here isn't really correct,
|
||||
|
@ -936,7 +933,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
*/
|
||||
public ConstructorDoc findConstructor(String constrName,
|
||||
String[] paramTypes) {
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
|
||||
if (e.sym.kind == Kinds.MTH) {
|
||||
if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
|
||||
|
@ -973,7 +970,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
}
|
||||
|
||||
private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
if (searched.contains(this)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1040,7 +1037,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
Env<AttrContext> compenv = env.enter.getEnv(tsym);
|
||||
if (compenv == null) return new ClassDocImpl[0];
|
||||
|
||||
Name asterisk = tsym.name.table.asterisk;
|
||||
Name asterisk = tsym.name.table.names.asterisk;
|
||||
for (JCTree t : compenv.toplevel.defs) {
|
||||
if (t.getTag() == JCTree.IMPORT) {
|
||||
JCTree imp = ((JCImport) t).qualid;
|
||||
|
@ -1076,7 +1073,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<PackageDocImpl>();
|
||||
|
||||
//### Add the implicit "import java.lang.*" to the result
|
||||
Name.Table names = tsym.name.table;
|
||||
Names names = tsym.name.table.names;
|
||||
importedPackages.append(env.getPackageDoc(env.reader.enterPackage(names.java_lang)));
|
||||
|
||||
Env<AttrContext> compenv = env.enter.getEnv(tsym);
|
||||
|
|
|
@ -33,13 +33,11 @@ import com.sun.javadoc.*;
|
|||
import com.sun.tools.javac.code.*;
|
||||
import com.sun.tools.javac.code.Symbol.*;
|
||||
import com.sun.tools.javac.code.Type.ClassType;
|
||||
import com.sun.tools.javac.code.Type.TypeVar;
|
||||
import com.sun.tools.javac.comp.Attr;
|
||||
import com.sun.tools.javac.comp.Check;
|
||||
import com.sun.tools.javac.tree.JCTree.*;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import com.sun.tools.javac.util.Position;
|
||||
|
||||
|
||||
|
@ -83,7 +81,7 @@ public class DocEnv {
|
|||
JavadocEnter enter;
|
||||
|
||||
/** The name table. */
|
||||
Name.Table names;
|
||||
Names names;
|
||||
|
||||
/** The encoding name. */
|
||||
private String encoding;
|
||||
|
@ -131,7 +129,7 @@ public class DocEnv {
|
|||
reader = JavadocClassReader.instance0(context);
|
||||
enter = JavadocEnter.instance0(context);
|
||||
attr = Attr.instance(context);
|
||||
names = Name.Table.instance(context);
|
||||
names = Names.instance(context);
|
||||
externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
|
||||
chk = Check.instance(context);
|
||||
types = Types.instance(context);
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.sun.tools.javac.code.Symbol.ClassSymbol;
|
|||
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
|
||||
/**
|
||||
* The serialized form is the specification of a class' serialization
|
||||
|
@ -149,7 +150,7 @@ class SerializedForm {
|
|||
* name SERIALIZABLE_FIELDS.
|
||||
*/
|
||||
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
|
||||
Name.Table names = def.name.table;
|
||||
Names names = def.name.table.names;
|
||||
|
||||
/* SERIALIZABLE_FIELDS can be private,
|
||||
* so must lookup by ClassSymbol, not by ClassDocImpl.
|
||||
|
@ -202,7 +203,7 @@ class SerializedForm {
|
|||
* @param visibility the visibility flag for the given method.
|
||||
*/
|
||||
private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
|
||||
Name.Table names = def.name.table;
|
||||
Names names = def.name.table.names;
|
||||
|
||||
for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) {
|
||||
if (e.sym.kind == Kinds.MTH) {
|
||||
|
@ -228,7 +229,7 @@ class SerializedForm {
|
|||
private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
|
||||
DocEnv env,
|
||||
ClassSymbol def) {
|
||||
Name.Table names = def.name.table;
|
||||
Names names = def.name.table.names;
|
||||
|
||||
SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
|
||||
for (int i = 0; i < sfTag.length; i++) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.sun.tools.javac.code.Type;
|
|||
import com.sun.tools.javac.code.Type.TypeVar;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
|
||||
/**
|
||||
* Implementation of <code>TypeVariable</code>, which
|
||||
|
@ -66,7 +67,7 @@ public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
|
|||
if ((osym.kind & Kinds.TYP) != 0) {
|
||||
return env.getClassDoc((ClassSymbol)osym);
|
||||
}
|
||||
Name.Table names = osym.name.table;
|
||||
Names names = osym.name.table.names;
|
||||
if (osym.name == names.init) {
|
||||
return env.getConstructorDoc((MethodSymbol)osym);
|
||||
} else {
|
||||
|
@ -113,7 +114,7 @@ public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
|
|||
*/
|
||||
private static List<Type> getBounds(TypeVar v, DocEnv env) {
|
||||
Name boundname = v.getUpperBound().tsym.getQualifiedName();
|
||||
if (boundname == boundname.table.java_lang_Object) {
|
||||
if (boundname == boundname.table.names.java_lang_Object) {
|
||||
return List.nil();
|
||||
} else {
|
||||
return env.types.getBounds(v);
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.Locale;
|
|||
|
||||
public class EnclosingCandidates {
|
||||
|
||||
Name.Table names = Name.Table.instance(new Context());
|
||||
Names names = Names.instance(new Context());
|
||||
|
||||
void test(String name, String... expected) {
|
||||
List<Name> result = enclosingCandidates(names.fromString(name));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue