This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/master by this push: new e4e3dfff Avoid a spotbugs complaint [skip ci] e4e3dfff is described below commit e4e3dfff33ec37977f466fae2643996793a5e127 Author: Sebb <s...@apache.org> AuthorDate: Sun Dec 17 00:04:43 2023 +0000 Avoid a spotbugs complaint [skip ci] --- src/main/java/org/apache/bcel/classfile/ConstantUtf8.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java b/src/main/java/org/apache/bcel/classfile/ConstantUtf8.java index 51a843c8..edbdfef8 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 @@ public final class ConstantUtf8 extends Constant { 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 final class ConstantUtf8 extends Constant { ConstantUtf8(final DataInput dataInput) throws IOException { super(Const.CONSTANT_Utf8); value = dataInput.readUTF(); - created++; + countCreated(); } /** @@ -207,7 +212,7 @@ public final class ConstantUtf8 extends Constant { public ConstantUtf8(final String value) { super(Const.CONSTANT_Utf8); this.value = Objects.requireNonNull(value, "value"); - created++; + countCreated(); } /**