diff --git a/pom.xml b/pom.xml index 833a7f1747..2035b710b3 100644 --- a/pom.xml +++ b/pom.xml @@ -330,8 +330,6 @@ Normal Default src/conf/spotbugs-exclude-filter.xml - - 9 diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml index 0698d4fa45..f917b60c7f 100644 --- a/src/conf/spotbugs-exclude-filter.xml +++ b/src/conf/spotbugs-exclude-filter.xml @@ -62,10 +62,29 @@ - - - + + + + + + + + + + + + + + + + @@ -91,4 +110,48 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java index 51a843c861..edbdfef8b4 100644 --- a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java +++ b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java @@ -178,6 +178,11 @@ static void printStats() { Cache.MAX_ENTRY_SIZE); } + // Avoid Spotbugs complaint about Write to static field + private static void countCreated() { + created++; + } + private final String value; /** @@ -198,7 +203,7 @@ public ConstantUtf8(final ConstantUtf8 constantUtf8) { ConstantUtf8(final DataInput dataInput) throws IOException { super(Const.CONSTANT_Utf8); value = dataInput.readUTF(); - created++; + countCreated(); } /** @@ -207,7 +212,7 @@ public ConstantUtf8(final ConstantUtf8 constantUtf8) { public ConstantUtf8(final String value) { super(Const.CONSTANT_Utf8); this.value = Objects.requireNonNull(value, "value"); - created++; + countCreated(); } /** diff --git a/src/main/java/org/apache/bcel/generic/InstructionList.java b/src/main/java/org/apache/bcel/generic/InstructionList.java index c373e3b3f5..ca053e4418 100644 --- a/src/main/java/org/apache/bcel/generic/InstructionList.java +++ b/src/main/java/org/apache/bcel/generic/InstructionList.java @@ -1129,6 +1129,9 @@ public void setPositions(final boolean check) { // called by code in other packa case Const.LOOKUPSWITCH: maxAdditionalBytes += 3; break; + default: + // TODO should this be an error? + break; } index += i.getLength(); }