Merge branch 'symboltable-tidyup' of https://github.com/Monits/pmd into pr-139

This commit is contained in:
Andreas Dangel
2016-12-09 09:29:55 +01:00
3 changed files with 6 additions and 5 deletions

View File

@ -5,6 +5,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;
@ -44,7 +45,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

@ -362,8 +362,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;
@ -55,7 +54,7 @@ public class SourceFileScope extends AbstractJavaScope {
}
public Set<String> getExplicitImports() {
return types != null ? types.getExplicitImports() : Collections.<String>emptySet();
return types.getExplicitImports();
}
/**