Merge branch 'symboltable-tidyup' of https://github.com/Monits/pmd into pr-139
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user