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-compress.git
commit 698cd9be5b342a1ce0381b3fdf6065c3cab57f75 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Fri Apr 11 10:22:18 2025 -0400 Remove superfluous private instance variable --- .../RuntimeVisibleorInvisibleAnnotationsAttribute.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java index 9eb038207..df48ddc8b 100644 --- a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java +++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java @@ -28,20 +28,18 @@ */ public class RuntimeVisibleorInvisibleAnnotationsAttribute extends AnnotationsAttribute { - private final int numAnnotations; private final Annotation[] annotations; public RuntimeVisibleorInvisibleAnnotationsAttribute(final CPUTF8 name, final Annotation[] annotations) { super(name); - this.numAnnotations = annotations.length; this.annotations = annotations; } @Override protected int getLength() { int length = 2; - for (int i = 0; i < numAnnotations; i++) { - length += annotations[i].getLength(); + for (final Annotation annotation : annotations) { + length += annotation.getLength(); } return length; } @@ -66,15 +64,15 @@ protected void resolve(final ClassConstantPool pool) { @Override public String toString() { - return attributeName.underlyingString() + ": " + numAnnotations + " annotations"; + return attributeName.underlyingString() + ": " + annotations.length + " annotations"; } @Override protected void writeBody(final DataOutputStream dos) throws IOException { final int size = dos.size(); - dos.writeShort(numAnnotations); - for (int i = 0; i < numAnnotations; i++) { - annotations[i].writeBody(dos); + dos.writeShort(annotations.length); + for (final Annotation annotation : annotations) { + annotation.writeBody(dos); } if (dos.size() - size != getLength()) { throw new Error();