This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
commit 581b303b6751769208dc9f36a0300a9f22b0953f Author: Gary David Gregory (Code signing key) <[email protected]> AuthorDate: Sat Jun 22 09:29:22 2024 -0400 Fix SpotBugs URF_UNREAD_FIELD in ClassDumper --- src/changes/changes.xml | 1 + src/examples/ClassDumper.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ab3cf2d3..da301fb4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -66,6 +66,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="update" dev="ggregory" due-to="Gary Gregory">Fix PMD EmptyControlStatement by allowing commented blocks.</action> <action type="update" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE in JasminVisitor.</action> <action type="update" dev="ggregory" due-to="Gary Gregory">SpotBugs checks should ignore code generated by JavaCC.</action> + <action type="update" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs URF_UNREAD_FIELD in ClassDumper.</action> <!-- ADD --> <action type="update" dev="ggregory" due-to="nbauma109, Gary Gregory, Mark Roberts">Add accessors to model and unit tests, Javadoc #183.</action> <!-- UPDATE --> diff --git a/src/examples/ClassDumper.java b/src/examples/ClassDumper.java index 6ebaaab9..4822dd7f 100644 --- a/src/examples/ClassDumper.java +++ b/src/examples/ClassDumper.java @@ -44,8 +44,8 @@ final class ClassDumper { private int[] interfaces; // Names of implemented interfaces private ConstantPool constantPool; // collection of constants private Constant[] constantItems; // collection of constants - private Field[] fields; // class fields, i.e., its variables - private Method[] methods; // methods defined in the class + // private Field[] fields; // class fields, i.e., its variables + // private Method[] methods; // methods defined in the class private Attribute[] attributes; // attributes defined in the class /** @@ -249,7 +249,7 @@ final class ClassDumper { */ private final void processFields() throws IOException, ClassFormatException { final int fieldsCount = file.readUnsignedShort(); - fields = new Field[fieldsCount]; + // fields = new Field[fieldsCount]; // sometimes fields[0] is magic used for serialization System.out.printf("%nFields(%d):%n", fieldsCount); @@ -313,7 +313,7 @@ final class ClassDumper { */ private final void processMethods() throws IOException, ClassFormatException { final int methodsCount = file.readUnsignedShort(); - methods = new Method[methodsCount]; + // methods = new Method[methodsCount]; System.out.printf("%nMethods(%d):%n", methodsCount);
