Skip to content

Commit

Permalink
Use final
Browse files Browse the repository at this point in the history
Use compact array notation
  • Loading branch information
garydgregory committed Apr 21, 2024
1 parent f670f11 commit 7ae5745
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,15 +505,15 @@ public void visitParameterAnnotationEntry(final ParameterAnnotationEntry obj) {
}

@Override
public void visitRecord(Record record) {
public void visitRecord(final Record record) {
stack.push(record);
record.accept(visitor);
accept(record.getComponents());
stack.pop();
}

@Override
public void visitRecordComponent(RecordComponentInfo recordComponentInfo) {
public void visitRecordComponent(final RecordComponentInfo recordComponentInfo) {
stack.push(recordComponentInfo);
recordComponentInfo.accept(visitor);
stack.pop();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/bcel/classfile/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public final class Record extends Attribute {

private static final RecordComponentInfo[] EMPTY_RCI_ARRAY = new RecordComponentInfo[] {};
private static final RecordComponentInfo[] EMPTY_RCI_ARRAY = {};

private static RecordComponentInfo[] readComponents(final DataInput input, final ConstantPool constantPool)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class RecordComponentInfo implements Node {
* @param constantPool Array of constants
* @throws IOException if an I/O error occurs.
*/
public RecordComponentInfo(final DataInput input, ConstantPool constantPool) throws IOException {
public RecordComponentInfo(final DataInput input, final ConstantPool constantPool) throws IOException {
this.index = input.readUnsignedShort();
this.descriptorIndex = input.readUnsignedShort();
final int attributesCount = input.readUnsignedShort();
Expand All @@ -56,7 +56,7 @@ public RecordComponentInfo(final DataInput input, ConstantPool constantPool) thr
}

@Override
public void accept(Visitor v) {
public void accept(final Visitor v) {
v.visitRecordComponent(this);
}

Expand All @@ -66,7 +66,7 @@ public void accept(Visitor v) {
* @param file Output file stream
* @throws IOException if an I/O error occurs.
*/
public void dump(DataOutputStream file) throws IOException {
public void dump(final DataOutputStream file) throws IOException {
file.writeShort(index);
file.writeShort(descriptorIndex);
file.writeShort(attributes.length);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/bcel/classfile/Visitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ default void visitRecord(final Record obj) {
* @param record component to visit
* @since 6.9.0
*/
default void visitRecordComponent(RecordComponentInfo record) {
default void visitRecordComponent(final RecordComponentInfo record) {
// noop
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,12 @@ public void visitParameterAnnotationEntry(final ParameterAnnotationEntry obj) {
}

@Override
public void visitRecord(Record obj) {
public void visitRecord(final Record obj) {
tostring = toString(obj);
}

@Override
public void visitRecordComponent(RecordComponentInfo obj) {
public void visitRecordComponent(final RecordComponentInfo obj) {
tostring = toString(obj);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testArrayStore() throws Exception {

@Test
public void testCreateInvokeNullArgTypes() throws Exception {
InstructionFactory factory = new InstructionFactory(new ClassGen(Repository.lookupClass(Object.class)));
final InstructionFactory factory = new InstructionFactory(new ClassGen(Repository.lookupClass(Object.class)));
factory.createInvoke("", "", Type.VOID, null, Const.INVOKESPECIAL, false); // Mustn't throw an NPE
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/apache/bcel/visitors/CountingVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,12 @@ public void visitParameterAnnotationEntry(final ParameterAnnotationEntry paramet
}

@Override
public void visitRecord(Record v) {
public void visitRecord(final Record v) {
recordCount++;
}

@Override
public void visitRecordComponent(RecordComponentInfo v) {
public void visitRecordComponent(final RecordComponentInfo v) {
recordComponentCount++;
}

Expand Down

0 comments on commit 7ae5745

Please sign in to comment.