--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Fri Feb 26 15:26:58 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Fri Feb 26 15:30:35 2010 -0800
@@ -270,6 +270,7 @@
return ts.toList();
}
+ @Override
public void visitTopLevel(JCCompilationUnit tree) {
JavaFileObject prev = log.useSource(tree.sourcefile);
boolean addEnv = false;
@@ -289,13 +290,13 @@
tree.packge = syms.unnamedPackage;
}
tree.packge.complete(); // Find all classes in package.
- Env<AttrContext> env = topLevelEnv(tree);
+ Env<AttrContext> topEnv = topLevelEnv(tree);
// Save environment of package-info.java file.
if (isPkgInfo) {
Env<AttrContext> env0 = typeEnvs.get(tree.packge);
if (env0 == null) {
- typeEnvs.put(tree.packge, env);
+ typeEnvs.put(tree.packge, topEnv);
} else {
JCCompilationUnit tree0 = env0.toplevel;
if (!fileManager.isSameFile(tree.sourcefile, tree0.sourcefile)) {
@@ -306,7 +307,7 @@
if (addEnv || (tree0.packageAnnotations.isEmpty() &&
tree.docComments != null &&
tree.docComments.get(tree) != null)) {
- typeEnvs.put(tree.packge, env);
+ typeEnvs.put(tree.packge, topEnv);
}
}
}
@@ -322,14 +323,15 @@
c.members_field = new Scope(c);
tree.packge.package_info = c;
}
- classEnter(tree.defs, env);
+ classEnter(tree.defs, topEnv);
if (addEnv) {
- todo.append(env);
+ todo.append(topEnv);
}
log.useSource(prev);
result = null;
}
+ @Override
public void visitClassDef(JCClassDecl tree) {
Symbol owner = env.info.scope.owner;
Scope enclScope = enterScope(env);
@@ -435,6 +437,7 @@
* Enter a symbol for type parameter in local scope, after checking that it
* is unique.
*/
+ @Override
public void visitTypeParameter(JCTypeParameter tree) {
TypeVar a = (tree.type != null)
? (TypeVar)tree.type
@@ -448,6 +451,7 @@
/** Default class enter visitor method: do nothing.
*/
+ @Override
public void visitTree(JCTree tree) {
result = null;
}
@@ -489,10 +493,8 @@
for (JCCompilationUnit tree : trees) {
if (tree.starImportScope.elems == null) {
JavaFileObject prev = log.useSource(tree.sourcefile);
- Env<AttrContext> env = typeEnvs.get(tree);
- if (env == null)
- env = topLevelEnv(tree);
- memberEnter.memberEnter(tree, env);
+ Env<AttrContext> topEnv = topLevelEnv(tree);
+ memberEnter.memberEnter(tree, topEnv);
log.useSource(prev);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Feb 26 15:26:58 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Feb 26 15:30:35 2010 -0800
@@ -607,10 +607,12 @@
public void visitNewArray(JCNewArray tree) {
tree.elemtype = translate(tree.elemtype, null);
translate(tree.dims, syms.intType);
- tree.elems = translate(tree.elems,
- (tree.type == null) ? null
- : erasure(types.elemtype(tree.type)));
- tree.type = erasure(tree.type);
+ if (tree.type != null) {
+ tree.elems = translate(tree.elems, erasure(types.elemtype(tree.type)));
+ tree.type = erasure(tree.type);
+ } else {
+ tree.elems = translate(tree.elems, null);
+ }
result = tree;
}