From b5ca7baa9adb3d445658f4429c88cc8a630aa26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Tue, 15 Nov 2016 03:36:08 -0300 Subject: [PATCH] Ensure className is never null --- .../sourceforge/pmd/lang/java/symboltable/ClassScope.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java index 8a6620f577..95c4face17 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java @@ -9,6 +9,7 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import net.sourceforge.pmd.lang.ast.Node; @@ -51,12 +52,12 @@ public class ClassScope extends AbstractJavaScope { } }; - private String className; + private final String className; private boolean isEnum; - public ClassScope(String className) { - this.className = className; + public ClassScope(final String className) { + this.className = Objects.requireNonNull(className); anonymousInnerClassCounter.set(Integer.valueOf(1)); }