Tiny improvements and code tidy up

This commit is contained in:
Juan Martín Sotuyo Dodero
2016-11-28 02:23:24 -03:00
parent a6e3a20d19
commit 52ee5e9b0b
3 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@
package net.sourceforge.pmd.lang.symboltable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@ -45,7 +46,7 @@ public abstract class AbstractScope implements Scope {
@SuppressWarnings("unchecked")
Map<T, List<NameOccurrence>> result = (Map<T, List<NameOccurrence>>)nameDeclarations.get(clazz);
if (result == null) {
result = new LinkedHashMap<>();
result = Collections.emptyMap();
}
return result;
}

View File

@ -356,8 +356,9 @@ public class ClassScope extends AbstractJavaScope {
}
Set<String> qualifiedNames = new LinkedHashSet<>();
qualifiedNames.addAll(this.getEnclosingScope(SourceFileScope.class).getQualifiedTypeNames().keySet());
qualifiedNames.addAll(this.getEnclosingScope(SourceFileScope.class).getExplicitImports());
final SourceFileScope fileScope = getEnclosingScope(SourceFileScope.class);
qualifiedNames.addAll(fileScope.getQualifiedTypeNames().keySet());
qualifiedNames.addAll(fileScope.getExplicitImports());
int nameLength = typeImage.length();

View File

@ -4,7 +4,6 @@
package net.sourceforge.pmd.lang.java.symboltable;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -52,7 +51,7 @@ public class SourceFileScope extends AbstractJavaScope {
}
public Set<String> getExplicitImports() {
return types != null ? types.getExplicitImports() : Collections.<String> emptySet();
return types.getExplicitImports();
}
/**