8029690: Move symbol creation from ClassReader to Symtab

Reviewed-by: jjg
This commit is contained in:
Joel Borggrén-Franck 2014-01-15 10:57:25 +01:00
parent 8a2542c71f
commit b3e2823f53
12 changed files with 194 additions and 195 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. 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
@ -25,16 +25,45 @@
package com.sun.tools.javac.code;
import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.lang.model.element.ElementVisitor;
import javax.tools.JavaFileObject;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.jvm.*;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.code.Symbol.ClassSymbol;
import com.sun.tools.javac.code.Symbol.Completer;
import com.sun.tools.javac.code.Symbol.CompletionFailure;
import com.sun.tools.javac.code.Symbol.MethodSymbol;
import com.sun.tools.javac.code.Symbol.OperatorSymbol;
import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.code.Symbol.TypeSymbol;
import com.sun.tools.javac.code.Symbol.VarSymbol;
import com.sun.tools.javac.code.Type.BottomType;
import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.code.Type.ErrorType;
import com.sun.tools.javac.code.Type.JCPrimitiveType;
import com.sun.tools.javac.code.Type.JCVoidType;
import com.sun.tools.javac.code.Type.MethodType;
import com.sun.tools.javac.code.Type.UnknownType;
import com.sun.tools.javac.jvm.ByteCodes;
import com.sun.tools.javac.jvm.ClassReader;
import com.sun.tools.javac.jvm.Target;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Convert;
import com.sun.tools.javac.util.JavacMessages;
import com.sun.tools.javac.util.List;
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.code.Flags.*;
import static com.sun.tools.javac.code.Kinds.PCK;
import static com.sun.tools.javac.code.Kinds.TYP;
import static com.sun.tools.javac.jvm.ByteCodes.*;
import static com.sun.tools.javac.code.TypeTag.*;
@ -75,7 +104,7 @@ public class Symtab {
public final JCVoidType voidType = new JCVoidType();
private final Names names;
private final ClassReader reader;
private final Completer initialCompleter;
private final Target target;
/** A symbol for the root package.
@ -308,7 +337,7 @@ public class Symtab {
* @param s The name of the class.
*/
private Type enterClass(String s) {
return reader.enterClass(names.fromString(s)).type;
return enterClass(names.fromString(s)).type;
}
public void synthesizeEmptyInterfaceIfMissing(final Type type) {
@ -328,7 +357,7 @@ public class Symtab {
}
public void synthesizeBoxTypeIfMissing(final Type type) {
ClassSymbol sym = reader.enterClass(boxedName[type.getTag().ordinal()]);
ClassSymbol sym = enterClass(boxedName[type.getTag().ordinal()]);
final Completer completer = sym.completer;
if (completer != null) {
sym.completer = new Completer() {
@ -390,6 +419,7 @@ public class Symtab {
// create the basic builtin symbols
rootPackage = new PackageSymbol(names.empty, null);
packages.put(names.empty, rootPackage);
final JavacMessages messages = JavacMessages.instance(context);
unnamedPackage = new PackageSymbol(names.empty, rootPackage) {
public String toString() {
@ -440,6 +470,11 @@ public class Symtab {
Scope scope = new Scope(predefClass);
predefClass.members_field = scope;
// Get the initial completer for Symbols from the ClassReader
initialCompleter = ClassReader.instance(context).getCompleter();
rootPackage.completer = initialCompleter;
unnamedPackage.completer = initialCompleter;
// Enter symbols for basic types.
scope.enter(byteType.tsym);
scope.enter(shortType.tsym);
@ -456,9 +491,6 @@ public class Symtab {
classes.put(predefClass.fullname, predefClass);
reader = ClassReader.instance(context);
reader.init(this);
// Enter predefined classes.
objectType = enterClass("java.lang.Object");
classType = enterClass("java.lang.Class");
@ -484,7 +516,7 @@ public class Symtab {
cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
annotationType = enterClass("java.lang.annotation.Annotation");
classLoaderType = enterClass("java.lang.ClassLoader");
enumSym = reader.enterClass(names.java_lang_Enum);
enumSym = enterClass(names.java_lang_Enum);
enumFinalFinalize =
new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
names.finalize,
@ -719,4 +751,102 @@ public class Symtab {
enterBinop("&&", booleanType, booleanType, booleanType, bool_and);
enterBinop("||", booleanType, booleanType, booleanType, bool_or);
}
/** Define a new class given its name and owner.
*/
public ClassSymbol defineClass(Name name, Symbol owner) {
ClassSymbol c = new ClassSymbol(0, name, owner);
if (owner.kind == PCK)
Assert.checkNull(classes.get(c.flatname), c);
c.completer = initialCompleter;
return c;
}
/** Create a new toplevel or member class symbol with given name
* and owner and enter in `classes' unless already there.
*/
public ClassSymbol enterClass(Name name, TypeSymbol owner) {
Name flatname = TypeSymbol.formFlatName(name, owner);
ClassSymbol c = classes.get(flatname);
if (c == null) {
c = defineClass(name, owner);
classes.put(flatname, c);
} else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) {
// reassign fields of classes that might have been loaded with
// their flat names.
c.owner.members().remove(c);
c.name = name;
c.owner = owner;
c.fullname = ClassSymbol.formFullName(name, owner);
}
return c;
}
/**
* Creates a new toplevel class symbol with given flat name and
* given class (or source) file.
*
* @param flatName a fully qualified binary class name
* @param classFile the class file or compilation unit defining
* the class (may be {@code null})
* @return a newly created class symbol
* @throws AssertionError if the class symbol already exists
*/
public ClassSymbol enterClass(Name flatName, JavaFileObject classFile) {
ClassSymbol cs = classes.get(flatName);
if (cs != null) {
String msg = Log.format("%s: completer = %s; class file = %s; source file = %s",
cs.fullname,
cs.completer,
cs.classfile,
cs.sourcefile);
throw new AssertionError(msg);
}
Name packageName = Convert.packagePart(flatName);
PackageSymbol owner = packageName.isEmpty()
? unnamedPackage
: enterPackage(packageName);
cs = defineClass(Convert.shortName(flatName), owner);
cs.classfile = classFile;
classes.put(flatName, cs);
return cs;
}
/** Create a new member or toplevel class symbol with given flat name
* and enter in `classes' unless already there.
*/
public ClassSymbol enterClass(Name flatname) {
ClassSymbol c = classes.get(flatname);
if (c == null)
return enterClass(flatname, (JavaFileObject)null);
else
return c;
}
/** Check to see if a package exists, given its fully qualified name.
*/
public boolean packageExists(Name fullname) {
return enterPackage(fullname).exists();
}
/** Make a package, given its fully qualified name.
*/
public PackageSymbol enterPackage(Name fullname) {
PackageSymbol p = packages.get(fullname);
if (p == null) {
Assert.check(!fullname.isEmpty(), "rootPackage missing!");
p = new PackageSymbol(
Convert.shortName(fullname),
enterPackage(Convert.packagePart(fullname)));
p.completer = initialCompleter;
packages.put(fullname, p);
}
return p;
}
/** Make a package, given its unqualified name and enclosing package.
*/
public PackageSymbol enterPackage(Name name, PackageSymbol owner) {
return enterPackage(TypeSymbol.formFullName(name, owner));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. 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
@ -3785,7 +3785,7 @@ public class Types {
* Return the class that boxes the given primitive.
*/
public ClassSymbol boxedClass(Type t) {
return reader.enterClass(syms.boxedName[t.getTag().ordinal()]);
return syms.enterClass(syms.boxedName[t.getTag().ordinal()]);
}
/**
@ -3805,7 +3805,7 @@ public class Types {
for (int i=0; i<syms.boxedName.length; i++) {
Name box = syms.boxedName[i];
if (box != null &&
asSuper(t, reader.enterClass(box)) != null)
asSuper(t, syms.enterClass(box)) != null)
return syms.typeOfTag[i];
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. 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
@ -285,7 +285,7 @@ public class Enter extends JCTree.Visitor {
boolean isPkgInfo = tree.sourcefile.isNameCompatible("package-info",
JavaFileObject.Kind.SOURCE);
if (tree.pid != null) {
tree.packge = reader.enterPackage(TreeInfo.fullName(tree.pid));
tree.packge = syms.enterPackage(TreeInfo.fullName(tree.pid));
if (tree.packageAnnotations.nonEmpty()
|| pkginfoOpt == PkgInfo.ALWAYS
|| tree.docComments != null) {
@ -326,7 +326,7 @@ public class Enter extends JCTree.Visitor {
q.flags_field |= EXISTS;
Name name = names.package_info;
ClassSymbol c = reader.enterClass(name, tree.packge);
ClassSymbol c = syms.enterClass(name, tree.packge);
c.flatname = names.fromString(tree.packge + "." + name);
c.sourcefile = tree.sourcefile;
c.completer = null;
@ -351,7 +351,7 @@ public class Enter extends JCTree.Visitor {
PackageSymbol packge = (PackageSymbol)owner;
for (Symbol q = packge; q != null && q.kind == PCK; q = q.owner)
q.flags_field |= EXISTS;
c = reader.enterClass(tree.name, packge);
c = syms.enterClass(tree.name, packge);
packge.members().enterIfAbsent(c);
if ((tree.mods.flags & PUBLIC) != 0 && !classNameMatchesFileName(c, env)) {
log.error(tree.pos(),
@ -365,13 +365,13 @@ public class Enter extends JCTree.Visitor {
}
if (owner.kind == TYP) {
// We are seeing a member class.
c = reader.enterClass(tree.name, (TypeSymbol)owner);
c = syms.enterClass(tree.name, (TypeSymbol)owner);
if ((owner.flags_field & INTERFACE) != 0) {
tree.mods.flags |= PUBLIC | STATIC;
}
} else {
// We are seeing a local class.
c = reader.defineClass(tree.name, owner);
c = syms.defineClass(tree.name, owner);
c.flatname = chk.localClassName(c);
if (!c.name.isEmpty())
chk.checkTransparentClass(tree.pos(), c, env.info.scope);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. 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
@ -635,7 +635,7 @@ public class Lower extends TreeTranslator {
JCClassDecl makeEmptyClass(long flags, ClassSymbol owner, Name flatname,
boolean addToDefs) {
// Create class symbol.
ClassSymbol c = reader.defineClass(names.empty, owner);
ClassSymbol c = syms.defineClass(names.empty, owner);
if (flatname != null) {
c.flatname = flatname;
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. 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
@ -519,7 +519,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
try {
// Import-on-demand java.lang.
importAll(tree.pos, reader.enterPackage(names.java_lang), env);
importAll(tree.pos, syms.enterPackage(names.java_lang), env);
// Process all import clauses.
memberEnter(tree.defs, env);
@ -1173,7 +1173,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
// name as a top-level package.
if (checkClash &&
c.owner.kind == PCK && c.owner != syms.unnamedPackage &&
reader.packageExists(c.fullname)) {
syms.packageExists(c.fullname)) {
log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c);
}
if (c.owner.kind == PCK && (c.flags_field & PUBLIC) == 0 &&

View File

@ -2075,7 +2075,7 @@ public class Resolve {
else if (sym.kind < bestSoFar.kind) bestSoFar = sym;
}
if ((kind & PCK) != 0) return reader.enterPackage(name);
if ((kind & PCK) != 0) return syms.enterPackage(name);
else return bestSoFar;
}
@ -2099,7 +2099,7 @@ public class Resolve {
Symbol bestSoFar = typeNotFound;
PackageSymbol pack = null;
if ((kind & PCK) != 0) {
pack = reader.enterPackage(fullname);
pack = syms.enterPackage(fullname);
if (pack.exists()) return pack;
}
if ((kind & TYP) != 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. 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
@ -165,15 +165,6 @@ public class ClassReader {
*/
public SourceCompleter sourceCompleter = null;
/** A hashtable containing the encountered top-level and member classes,
* indexed by flat names. The table does not contain local classes.
*/
private Map<Name,ClassSymbol> classes;
/** A hashtable containing the encountered packages.
*/
private Map<Name, PackageSymbol> packages;
/** The current scope where type variables are entered.
*/
protected Scope typevars;
@ -240,47 +231,21 @@ public class ClassReader {
}
};
public Completer getCompleter() {
return thisCompleter;
}
/** Get the ClassReader instance for this invocation. */
public static ClassReader instance(Context context) {
ClassReader instance = context.get(classReaderKey);
if (instance == null)
instance = new ClassReader(context, true);
instance = new ClassReader(context);
return instance;
}
/** Initialize classes and packages, treating this as the definitive classreader. */
public void init(Symtab syms) {
init(syms, true);
}
/** Initialize classes and packages, optionally treating this as
* the definitive classreader.
*/
private void init(Symtab syms, boolean definitive) {
if (classes != null) return;
if (definitive) {
Assert.check(packages == null || packages == syms.packages);
packages = syms.packages;
Assert.check(classes == null || classes == syms.classes);
classes = syms.classes;
} else {
packages = new HashMap<>();
classes = new HashMap<>();
}
packages.put(names.empty, syms.rootPackage);
syms.rootPackage.completer = thisCompleter;
syms.unnamedPackage.completer = thisCompleter;
}
/** Construct a new class reader, optionally treated as the
* definitive classreader for this invocation.
*/
protected ClassReader(Context context, boolean definitive) {
if (definitive) context.put(classReaderKey, this);
/** Construct a new class reader. */
protected ClassReader(Context context) {
context.put(classReaderKey, this);
names = Names.instance(context);
syms = Symtab.instance(context);
types = Types.instance(context);
@ -289,7 +254,6 @@ public class ClassReader {
throw new AssertionError("FileManager initialization error");
diagFactory = JCDiagnostic.Factory.instance(context);
init(syms, definitive);
log = Log.instance(context);
Options options = Options.instance(context);
@ -573,7 +537,7 @@ public class ClassReader {
// simplified to (buf[start] == '[')
return (buf[start] == '[' || buf[start + len - 1] == ';')
? (Object)sigToType(buf, start, len)
: (Object)enterClass(names.fromUtf(internalize(buf, start,
: (Object)syms.enterClass(names.fromUtf(internalize(buf, start,
len)));
}
@ -736,7 +700,7 @@ public class ClassReader {
switch (c) {
case ';': { // end
ClassSymbol t = enterClass(names.fromUtf(signatureBuffer,
ClassSymbol t = syms.enterClass(names.fromUtf(signatureBuffer,
startSbp,
sbp - startSbp));
@ -750,7 +714,7 @@ public class ClassReader {
}
case '<': // generic arguments
ClassSymbol t = enterClass(names.fromUtf(signatureBuffer,
ClassSymbol t = syms.enterClass(names.fromUtf(signatureBuffer,
startSbp,
sbp - startSbp));
outer = new ClassType(outer, sigToTypes('>'), t) {
@ -813,7 +777,7 @@ public class ClassReader {
case '.':
//we have seen an enclosing non-generic class
if (outer != Type.noType) {
t = enterClass(names.fromUtf(signatureBuffer,
t = syms.enterClass(names.fromUtf(signatureBuffer,
startSbp,
sbp - startSbp));
outer = new ClassType(outer, List.<Type>nil(), t);
@ -1476,7 +1440,7 @@ public class ClassReader {
int index = poolIdx[i];
int length = getChar(index + 1);
if (buf[index + length + 2] != ';')
return enterClass(readName(i)).type;
return syms.enterClass(readName(i)).type;
return readType(i);
}
@ -2240,7 +2204,7 @@ public class ClassReader {
if (outer != null) { // we have a member class
if (name == names.empty)
name = names.one;
ClassSymbol member = enterClass(name, outer);
ClassSymbol member = syms.enterClass(name, outer);
if ((flags & STATIC) == 0) {
((ClassType)member.type).setEnclosingType(outer.type);
if (member.erasure_field != null)
@ -2324,77 +2288,6 @@ public class ClassReader {
* Loading Classes
***********************************************************************/
/** Define a new class given its name and owner.
*/
public ClassSymbol defineClass(Name name, Symbol owner) {
ClassSymbol c = new ClassSymbol(0, name, owner);
if (owner.kind == PCK)
Assert.checkNull(classes.get(c.flatname), c);
c.completer = thisCompleter;
return c;
}
/** Create a new toplevel or member class symbol with given name
* and owner and enter in `classes' unless already there.
*/
public ClassSymbol enterClass(Name name, TypeSymbol owner) {
Name flatname = TypeSymbol.formFlatName(name, owner);
ClassSymbol c = classes.get(flatname);
if (c == null) {
c = defineClass(name, owner);
classes.put(flatname, c);
} else if ((c.name != name || c.owner != owner) && owner.kind == TYP && c.owner.kind == PCK) {
// reassign fields of classes that might have been loaded with
// their flat names.
c.owner.members().remove(c);
c.name = name;
c.owner = owner;
c.fullname = ClassSymbol.formFullName(name, owner);
}
return c;
}
/**
* Creates a new toplevel class symbol with given flat name and
* given class (or source) file.
*
* @param flatName a fully qualified binary class name
* @param classFile the class file or compilation unit defining
* the class (may be {@code null})
* @return a newly created class symbol
* @throws AssertionError if the class symbol already exists
*/
public ClassSymbol enterClass(Name flatName, JavaFileObject classFile) {
ClassSymbol cs = classes.get(flatName);
if (cs != null) {
String msg = Log.format("%s: completer = %s; class file = %s; source file = %s",
cs.fullname,
cs.completer,
cs.classfile,
cs.sourcefile);
throw new AssertionError(msg);
}
Name packageName = Convert.packagePart(flatName);
PackageSymbol owner = packageName.isEmpty()
? syms.unnamedPackage
: enterPackage(packageName);
cs = defineClass(Convert.shortName(flatName), owner);
cs.classfile = classFile;
classes.put(flatName, cs);
return cs;
}
/** Create a new member or toplevel class symbol with given flat name
* and enter in `classes' unless already there.
*/
public ClassSymbol enterClass(Name flatname) {
ClassSymbol c = classes.get(flatname);
if (c == null)
return enterClass(flatname, (JavaFileObject)null);
else
return c;
}
/** Completion for classes to be loaded. Before a class is loaded
* we make sure its enclosing class (if any) is loaded.
*/
@ -2442,7 +2335,7 @@ public class ClassReader {
for (Name name : Convert.enclosingCandidates(Convert.shortName(c.name))) {
Symbol encl = owner.members().lookup(name).sym;
if (encl == null)
encl = classes.get(TypeSymbol.formFlatName(name, owner));
encl = syms.classes.get(TypeSymbol.formFlatName(name, owner));
if (encl != null)
encl.complete();
}
@ -2584,17 +2477,18 @@ public class ClassReader {
cachedCompletionFailure.setStackTrace(new StackTraceElement[0]);
}
/** Load a toplevel class with given fully qualified name
* The class is entered into `classes' only if load was successful.
*/
public ClassSymbol loadClass(Name flatname) throws CompletionFailure {
boolean absent = classes.get(flatname) == null;
ClassSymbol c = enterClass(flatname);
boolean absent = syms.classes.get(flatname) == null;
ClassSymbol c = syms.enterClass(flatname);
if (c.members_field == null && c.completer != null) {
try {
c.complete();
} catch (CompletionFailure ex) {
if (absent) classes.remove(flatname);
if (absent) syms.classes.remove(flatname);
throw ex;
}
}
@ -2605,33 +2499,6 @@ public class ClassReader {
* Loading Packages
***********************************************************************/
/** Check to see if a package exists, given its fully qualified name.
*/
public boolean packageExists(Name fullname) {
return enterPackage(fullname).exists();
}
/** Make a package, given its fully qualified name.
*/
public PackageSymbol enterPackage(Name fullname) {
PackageSymbol p = packages.get(fullname);
if (p == null) {
Assert.check(!fullname.isEmpty(), "rootPackage missing!");
p = new PackageSymbol(
Convert.shortName(fullname),
enterPackage(Convert.packagePart(fullname)));
p.completer = thisCompleter;
packages.put(fullname, p);
}
return p;
}
/** Make a package, given its unqualified name and enclosing package.
*/
public PackageSymbol enterPackage(Name name, PackageSymbol owner) {
return enterPackage(TypeSymbol.formFullName(name, owner));
}
/** Include class corresponding to given class file in package,
* unless (1) we already have one the same kind (.class or .java), or
* (2) we have one of the other kind, and the given class file
@ -2655,7 +2522,7 @@ public class ClassReader {
? p.package_info
: (ClassSymbol) p.members_field.lookup(classname).sym;
if (c == null) {
c = enterClass(classname, p);
c = syms.enterClass(classname, p);
if (c.classfile == null) // only update the file if's it's newly created
c.classfile = file;
if (isPkgInfo) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. 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
@ -984,7 +984,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
/** Enter a set of generated class files. */
private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
ClassReader reader = ClassReader.instance(context);
Symtab symtab = Symtab.instance(context);
Names names = Names.instance(context);
List<ClassSymbol> list = List.nil();
@ -996,14 +996,14 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
ClassSymbol cs;
if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
Name packageName = Convert.packagePart(name);
PackageSymbol p = reader.enterPackage(packageName);
PackageSymbol p = symtab.enterPackage(packageName);
if (p.package_info == null)
p.package_info = reader.enterClass(Convert.shortName(name), p);
p.package_info = symtab.enterClass(Convert.shortName(name), p);
cs = p.package_info;
if (cs.classfile == null)
cs.classfile = file;
} else
cs = reader.enterClass(name, file);
cs = symtab.enterClass(name, file);
list = list.prepend(cs);
}
return list.reverse();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. 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
@ -1148,7 +1148,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
//### Add the implicit "import java.lang.*" to the result
Names names = tsym.name.table.names;
importedPackages.append(env.getPackageDoc(env.reader.enterPackage(names.java_lang)));
importedPackages.append(env.getPackageDoc(env.syms.enterPackage(names.java_lang)));
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null) return new PackageDocImpl[0];

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. 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
@ -142,7 +142,7 @@ public class DocEnv {
reader = JavadocClassReader.instance0(context);
enter = JavadocEnter.instance0(context);
names = Names.instance(context);
externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
externalizableSym = syms.enterClass(names.fromString("java.io.Externalizable"));
chk = Check.instance(context);
types = Types.instance(context);
fileManager = context.get(JavaFileManager.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. 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
@ -66,7 +66,7 @@ public class JavadocClassReader extends ClassReader {
JavaFileObject.Kind.HTML);
public JavadocClassReader(Context context) {
super(context, true);
super(context);
docenv = DocEnv.instance(context);
preferSource = true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. 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
@ -34,6 +34,7 @@ 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.Symtab;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.code.TypeTag;
@ -363,6 +364,7 @@ public class T6889255 {
Context ctx = new Context();
JavacFileManager fm = new JavacFileManager(ctx, true, null);
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir));
Symtab syms = Symtab.instance(ctx);
ClassReader cr = ClassReader.instance(ctx);
cr.saveParameterNames = true;
Names names = Names.instance(ctx);
@ -372,7 +374,7 @@ public class T6889255 {
String classname;
while ((classname = work.poll()) != null) {
System.err.println("Checking class " + classname);
ClassSymbol sym = cr.enterClass(names.table.fromString(classname));
ClassSymbol sym = syms.enterClass(names.table.fromString(classname));
sym.complete();
if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)