changeset 22450:a81ce6432372

Merge
author asaha
date Wed, 15 Jan 2014 10:18:06 -0800
parents 1fd6d4bec7dd 0922d94d0576
children b7fe3561a5cd
files
diffstat 15 files changed, 228 insertions(+), 216 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 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 @@
      *  @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 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 @@
 
         // 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 @@
         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 @@
 
         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 @@
         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 @@
         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));
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
      * 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 @@
             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];
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
         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 @@
                 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 @@
             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 @@
             }
             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);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
     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 {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
 
         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 @@
             // 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 &&
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jan 15 10:18:06 2014 -0800
@@ -2075,7 +2075,7 @@
             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 @@
         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) {
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 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 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 @@
             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 @@
         // 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 @@
             switch (c) {
 
             case ';': {         // end
-                ClassSymbol t = enterClass(names.fromUtf(signatureBuffer,
+                ClassSymbol t = syms.enterClass(names.fromUtf(signatureBuffer,
                                                          startSbp,
                                                          sbp - startSbp));
 
@@ -750,7 +714,7 @@
             }
 
             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 @@
             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 @@
         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 @@
             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 @@
  * 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 @@
             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 @@
             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 @@
  * 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 @@
             ? 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) {
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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
@@ -2189,9 +2189,9 @@
         // Keep local variables if
         // 1) we need them for debug information
         // 2) it is an exception type and it contains type annotations
-        if (!varDebugInfo &&
-                (!var.sym.isExceptionParameter() ||
-                var.sym.hasTypeAnnotations())) return;
+        boolean keepLocalVariables = varDebugInfo ||
+            (var.sym.isExceptionParameter() && var.sym.hasTypeAnnotations());
+        if (!keepLocalVariables) return;
         if ((var.sym.flags() & Flags.SYNTHETIC) != 0) return;
         if (varBuffer == null)
             varBuffer = new LocalVar[20];
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
 
         /** 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 @@
                 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();
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
 
         //### 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];
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
         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);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocClassReader.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocClassReader.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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 @@
                                                                JavaFileObject.Kind.HTML);
 
     public JavadocClassReader(Context context) {
-        super(context, true);
+        super(context);
         docenv = DocEnv.instance(context);
         preferSource = true;
     }
--- a/langtools/test/tools/javac/6889255/T6889255.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/test/tools/javac/6889255/T6889255.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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.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 @@
         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 @@
         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)
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Wed Jan 15 10:18:06 2014 -0800
@@ -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
@@ -30,6 +30,7 @@
 import java.lang.annotation.*;
 import java.lang.reflect.*;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -51,6 +52,11 @@
         new Driver().runDriver(clazz.newInstance());
     }
 
+    String[][] extraParamsCombinations = new String[][] {
+        new String[] { },
+        new String[] { "-g" },
+    };
+
     protected void runDriver(Object object) throws Exception {
         int passed = 0, failed = 0;
         Class<?> clazz = object.getClass();
@@ -65,18 +71,20 @@
                 throw new IllegalArgumentException("Test method needs to return a string: " + method);
             String testClass = testClassOf(method);
 
-            try {
-                String compact = (String)method.invoke(object);
-                String fullFile = wrap(compact);
-                ClassFile cf = compileAndReturn(fullFile, testClass);
-                List<TypeAnnotation> actual = ReferenceInfoUtil.extendedAnnotationsOf(cf);
-                ReferenceInfoUtil.compare(expected, actual, cf);
-                out.println("PASSED:  " + method.getName());
-                ++passed;
-            } catch (Throwable e) {
-                out.println("FAILED:  " + method.getName());
-                out.println("    " + e.toString());
-                ++failed;
+            for (String[] extraParams : extraParamsCombinations) {
+                try {
+                    String compact = (String)method.invoke(object);
+                    String fullFile = wrap(compact);
+                    ClassFile cf = compileAndReturn(fullFile, testClass, extraParams);
+                    List<TypeAnnotation> actual = ReferenceInfoUtil.extendedAnnotationsOf(cf);
+                    ReferenceInfoUtil.compare(expected, actual, cf);
+                    out.println("PASSED:  " + method.getName());
+                    ++passed;
+                } catch (Throwable e) {
+                    out.println("FAILED:  " + method.getName());
+                    out.println("    " + e.toString());
+                    ++failed;
+                }
             }
         }
 
@@ -156,7 +164,7 @@
         }
     }
 
-    private ClassFile compileAndReturn(String fullFile, String testClass) throws Exception {
+    private ClassFile compileAndReturn(String fullFile, String testClass, String... extraParams) throws Exception {
         File source = writeTestFile(fullFile);
         File clazzFile = compileTestFile(source, testClass);
         return ClassFile.read(clazzFile);
@@ -170,8 +178,12 @@
         return f;
     }
 
-    protected File compileTestFile(File f, String testClass) {
-        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+    protected File compileTestFile(File f, String testClass, String... extraParams) {
+        List<String> options = new ArrayList<>();
+        options.addAll(Arrays.asList("-source", "1.8"));
+        options.addAll(Arrays.asList(extraParams));
+        options.add(f.getPath());
+        int rc = com.sun.tools.javac.Main.compile(options.toArray(new String[options.size()]));
         if (rc != 0)
             throw new Error("compilation failed. rc=" + rc);
         String path;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Tue Jan 14 08:08:32 2014 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Wed Jan 15 10:18:06 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,6 +25,7 @@
 
 /*
  * @test
+ * @bug 8028576
  * @summary Test population of reference info for exception parameters
  * @author Werner Dietl
  * @compile -g Driver.java ReferenceInfoUtil.java ExceptionParameters.java