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

This commit is contained in:
Andreas Dangel
2017-04-14 11:27:11 +02:00
2 changed files with 8 additions and 2 deletions

View File

@ -26,6 +26,7 @@ public class SourceFileScope extends AbstractJavaScope {
private final String packageImage;
private final TypeSet types;
private Map<String, Node> qualifiedTypeNames;
public SourceFileScope(final ClassLoader classLoader) {
this(classLoader, "");
@ -136,7 +137,12 @@ public class SourceFileScope extends AbstractJavaScope {
* @return set of all types in this source file.
*/
public Map<String, Node> getQualifiedTypeNames() {
return getSubTypes(null, this);
if (qualifiedTypeNames != null) {
return qualifiedTypeNames;
}
qualifiedTypeNames = getSubTypes(null, this);
return qualifiedTypeNames;
}
private Map<String, Node> getSubTypes(String qualifyingName, Scope subType) {