Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariable.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariable.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariable.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariable.java Tue Jun 21 20:50:19 2016 @@ -183,9 +183,9 @@ public final class LocalVariable impleme * Helper method shared with LocalVariableTypeTable */ final String toStringShared( final boolean typeTable ) { - String name = getName(); - String signature = Utility.signatureToString(getSignature(), false); - String label = "LocalVariable" + (typeTable ? "Types" : "" ); + final String name = getName(); + final String signature = Utility.signatureToString(getSignature(), false); + final String label = "LocalVariable" + (typeTable ? "Types" : "" ); return label + "(start_pc = " + start_pc + ", length = " + length + ", index = " + index + ":" + signature + " " + name + ")"; } @@ -254,7 +254,7 @@ public final class LocalVariable impleme public LocalVariable copy() { try { return (LocalVariable) clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { // TODO should this throw? } return null;
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTable.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTable.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTable.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTable.java Tue Jun 21 20:50:19 2016 @@ -69,7 +69,7 @@ public class LocalVariableTable extends LocalVariableTable(final int name_index, final int length, final DataInput input, final ConstantPool constant_pool) throws IOException { this(name_index, length, (LocalVariable[]) null, constant_pool); - int local_variable_table_length = input.readUnsignedShort(); + final int local_variable_table_length = input.readUnsignedShort(); local_variable_table = new LocalVariable[local_variable_table_length]; for (int i = 0; i < local_variable_table_length; i++) { local_variable_table[i] = new LocalVariable(input, constant_pool); @@ -100,7 +100,7 @@ public class LocalVariableTable extends public final void dump( final DataOutputStream file ) throws IOException { super.dump(file); file.writeShort(local_variable_table.length); - for (LocalVariable variable : local_variable_table) { + for (final LocalVariable variable : local_variable_table) { variable.dump(file); } } @@ -125,7 +125,7 @@ public class LocalVariableTable extends */ @java.lang.Deprecated public final LocalVariable getLocalVariable( final int index ) { - for (LocalVariable variable : local_variable_table) { + for (final LocalVariable variable : local_variable_table) { if (variable.getIndex() == index) { return variable; } @@ -142,10 +142,10 @@ public class LocalVariableTable extends * @return the LocalVariable that matches or null if not found */ public final LocalVariable getLocalVariable( final int index, final int pc ) { - for (LocalVariable variable : local_variable_table) { + for (final LocalVariable variable : local_variable_table) { if (variable.getIndex() == index) { - int start_pc = variable.getStartPC(); - int end_pc = start_pc + variable.getLength(); + final int start_pc = variable.getStartPC(); + final int end_pc = start_pc + variable.getLength(); if ((pc >= start_pc) && (pc <= end_pc)) { return variable; } @@ -165,7 +165,7 @@ public class LocalVariableTable extends */ @Override public final String toString() { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < local_variable_table.length; i++) { buf.append(local_variable_table[i]); if (i < local_variable_table.length - 1) { @@ -181,7 +181,7 @@ public class LocalVariableTable extends */ @Override public Attribute copy( final ConstantPool _constant_pool ) { - LocalVariableTable c = (LocalVariableTable) clone(); + final LocalVariableTable c = (LocalVariableTable) clone(); c.local_variable_table = new LocalVariable[local_variable_table.length]; for (int i = 0; i < local_variable_table.length; i++) { c.local_variable_table[i] = local_variable_table[i].copy(); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTypeTable.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTypeTable.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTypeTable.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/LocalVariableTypeTable.java Tue Jun 21 20:50:19 2016 @@ -70,7 +70,7 @@ public class LocalVariableTypeTable exte LocalVariableTypeTable(final int nameIdx, final int len, final DataInput input, final ConstantPool cpool) throws IOException { this(nameIdx, len, (LocalVariable[]) null, cpool); - int local_variable_type_table_length = input.readUnsignedShort(); + final int local_variable_type_table_length = input.readUnsignedShort(); local_variable_type_table = new LocalVariable[local_variable_type_table_length]; for (int i = 0; i < local_variable_type_table_length; i++) { @@ -87,7 +87,7 @@ public class LocalVariableTypeTable exte public final void dump(final DataOutputStream file) throws IOException { super.dump(file); file.writeShort(local_variable_type_table.length); - for (LocalVariable variable : local_variable_type_table) { + for (final LocalVariable variable : local_variable_type_table) { variable.dump(file); } } @@ -97,7 +97,7 @@ public class LocalVariableTypeTable exte } public final LocalVariable getLocalVariable(final int index) { - for (LocalVariable variable : local_variable_type_table) { + for (final LocalVariable variable : local_variable_type_table) { if (variable.getIndex() == index) { return variable; } @@ -115,7 +115,7 @@ public class LocalVariableTypeTable exte */ @Override public final String toString() { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < local_variable_type_table.length; i++) { buf.append(local_variable_type_table[i].toStringShared(true)); @@ -133,7 +133,7 @@ public class LocalVariableTypeTable exte */ @Override public Attribute copy(final ConstantPool constant_pool) { - LocalVariableTypeTable c = (LocalVariableTypeTable) clone(); + final LocalVariableTypeTable c = (LocalVariableTypeTable) clone(); c.local_variable_type_table = new LocalVariable[local_variable_type_table.length]; for (int i = 0; i < local_variable_type_table.length; i++) { Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Method.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Method.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Method.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Method.java Tue Jun 21 20:50:19 2016 @@ -37,8 +37,8 @@ public final class Method extends FieldO @Override public boolean equals( final Object o1, final Object o2 ) { - Method THIS = (Method) o1; - Method THAT = (Method) o2; + final Method THIS = (Method) o1; + final Method THAT = (Method) o2; return THIS.getName().equals(THAT.getName()) && THIS.getSignature().equals(THAT.getSignature()); } @@ -46,7 +46,7 @@ public final class Method extends FieldO @Override public int hashCode( final Object o ) { - Method THIS = (Method) o; + final Method THIS = (Method) o; return THIS.getSignature().hashCode() ^ THIS.getName().hashCode(); } }; @@ -113,7 +113,7 @@ public final class Method extends FieldO * @return Code attribute of method, if any */ public final Code getCode() { - for (Attribute attribute : super.getAttributes()) { + for (final Attribute attribute : super.getAttributes()) { if (attribute instanceof Code) { return (Code) attribute; } @@ -127,7 +127,7 @@ public final class Method extends FieldO * exceptions the method may throw not exception handlers! */ public final ExceptionTable getExceptionTable() { - for (Attribute attribute : super.getAttributes()) { + for (final Attribute attribute : super.getAttributes()) { if (attribute instanceof ExceptionTable) { return (ExceptionTable) attribute; } @@ -140,7 +140,7 @@ public final class Method extends FieldO * to the Code atribute. */ public final LocalVariableTable getLocalVariableTable() { - Code code = getCode(); + final Code code = getCode(); if (code == null) { return null; } @@ -152,7 +152,7 @@ public final class Method extends FieldO * to the Code atribute. */ public final LineNumberTable getLineNumberTable() { - Code code = getCode(); + final Code code = getCode(); if (code == null) { return null; } @@ -168,23 +168,23 @@ public final class Method extends FieldO */ @Override public final String toString() { - String access = Utility.accessToString(super.getAccessFlags()); + final String access = Utility.accessToString(super.getAccessFlags()); // Get name and signature from constant pool ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(super.getSignatureIndex(), Const.CONSTANT_Utf8); String signature = c.getBytes(); c = (ConstantUtf8) super.getConstantPool().getConstant(super.getNameIndex(), Const.CONSTANT_Utf8); - String name = c.getBytes(); + final String name = c.getBytes(); signature = Utility.methodSignatureToString(signature, name, access, true, getLocalVariableTable()); - StringBuilder buf = new StringBuilder(signature); - for (Attribute attribute : super.getAttributes()) { + final StringBuilder buf = new StringBuilder(signature); + for (final Attribute attribute : super.getAttributes()) { if (!((attribute instanceof Code) || (attribute instanceof ExceptionTable))) { buf.append(" [").append(attribute).append("]"); } } - ExceptionTable e = getExceptionTable(); + final ExceptionTable e = getExceptionTable(); if (e != null) { - String str = e.toString(); + final String str = e.toString(); if (!str.isEmpty()) { buf.append("\n\t\tthrows ").append(str); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameter.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameter.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameter.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameter.java Tue Jun 21 20:50:19 2016 @@ -108,7 +108,7 @@ public class MethodParameter implements public MethodParameter copy() { try { return (MethodParameter) clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { // TODO should this throw? } return null; Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameters.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameters.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameters.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/MethodParameters.java Tue Jun 21 20:50:19 2016 @@ -37,7 +37,7 @@ public class MethodParameters extends At MethodParameters(final int name_index, final int length, final DataInput input, final ConstantPool constant_pool) throws IOException { super(Const.ATTR_METHOD_PARAMETERS, name_index, length, constant_pool); - int parameters_count = input.readUnsignedByte(); + final int parameters_count = input.readUnsignedByte(); parameters = new MethodParameter[parameters_count]; for (int i = 0; i < parameters_count; i++) { parameters[i] = new MethodParameter(input); @@ -59,7 +59,7 @@ public class MethodParameters extends At @Override public Attribute copy(final ConstantPool _constant_pool) { - MethodParameters c = (MethodParameters) clone(); + final MethodParameters c = (MethodParameters) clone(); c.parameters = new MethodParameter[parameters.length]; for (int i = 0; i < parameters.length; i++) { @@ -79,7 +79,7 @@ public class MethodParameters extends At public void dump(final DataOutputStream file) throws IOException { super.dump(file); file.writeByte(parameters.length); - for (MethodParameter parameter : parameters) { + for (final MethodParameter parameter : parameters) { parameter.dump(file); } } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/PMGClass.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/PMGClass.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/PMGClass.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/PMGClass.java Tue Jun 21 20:50:19 2016 @@ -138,7 +138,7 @@ public final class PMGClass extends Attr * @return PMG name. */ public final String getPMGName() { - ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(pmg_index, + final ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(pmg_index, Const.CONSTANT_Utf8); return c.getBytes(); } @@ -148,7 +148,7 @@ public final class PMGClass extends Attr * @return PMG class name. */ public final String getPMGClassName() { - ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(pmg_class_index, + final ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(pmg_class_index, Const.CONSTANT_Utf8); return c.getBytes(); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotationEntry.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotationEntry.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotationEntry.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotationEntry.java Tue Jun 21 20:50:19 2016 @@ -42,7 +42,7 @@ public class ParameterAnnotationEntry im * @throws IOException */ ParameterAnnotationEntry(final DataInput input, final ConstantPool constant_pool) throws IOException { - int annotation_table_length = input.readUnsignedShort(); + final int annotation_table_length = input.readUnsignedShort(); annotation_table = new AnnotationEntry[annotation_table_length]; for (int i = 0; i < annotation_table_length; i++) { // TODO isRuntimeVisible @@ -72,17 +72,17 @@ public class ParameterAnnotationEntry im public void dump(final DataOutputStream dos) throws IOException { dos.writeShort(annotation_table.length); - for (AnnotationEntry entry : annotation_table) { + for (final AnnotationEntry entry : annotation_table) { entry.dump(dos); } } public static ParameterAnnotationEntry[] createParameterAnnotationEntries(final Attribute[] attrs) { // Find attributes that contain parameter annotation data - List<ParameterAnnotationEntry> accumulatedAnnotations = new ArrayList<>(attrs.length); - for (Attribute attribute : attrs) { + final List<ParameterAnnotationEntry> accumulatedAnnotations = new ArrayList<>(attrs.length); + for (final Attribute attribute : attrs) { if (attribute instanceof ParameterAnnotations) { - ParameterAnnotations runtimeAnnotations = (ParameterAnnotations)attribute; + final ParameterAnnotations runtimeAnnotations = (ParameterAnnotations)attribute; Collections.addAll(accumulatedAnnotations, runtimeAnnotations.getParameterAnnotationEntries()); } } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/ParameterAnnotations.java Tue Jun 21 20:50:19 2016 @@ -43,7 +43,7 @@ public abstract class ParameterAnnotatio final DataInput input, final ConstantPool constant_pool) throws IOException { this(parameter_annotation_type, name_index, length, (ParameterAnnotationEntry[]) null, constant_pool); - int num_parameters = input.readUnsignedByte(); + final int num_parameters = input.readUnsignedByte(); parameter_annotation_table = new ParameterAnnotationEntry[num_parameters]; for (int i = 0; i < num_parameters; i++) { parameter_annotation_table[i] = new ParameterAnnotationEntry(input, constant_pool); @@ -107,7 +107,7 @@ public abstract class ParameterAnnotatio super.dump(dos); dos.writeByte(parameter_annotation_table.length); - for (ParameterAnnotationEntry element : parameter_annotation_table) { + for (final ParameterAnnotationEntry element : parameter_annotation_table) { element.dump(dos); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Signature.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Signature.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Signature.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Signature.java Tue Jun 21 20:50:19 2016 @@ -118,7 +118,7 @@ public final class Signature extends Att * @return GJ signature. */ public final String getSignature() { - ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(signature_index, + final ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(signature_index, Const.CONSTANT_Utf8); return c.getBytes(); } @@ -159,7 +159,7 @@ public final class Signature extends Att } //System.out.println("return from ident:" + (char)ch); if (!identStart(ch)) { - StringBuilder buf2 = new StringBuilder(); + final StringBuilder buf2 = new StringBuilder(); int count = 1; while (Character.isJavaIdentifierPart((char) ch)) { buf2.append((char) ch); @@ -179,7 +179,7 @@ public final class Signature extends Att } return; } - StringBuilder buf2 = new StringBuilder(); + final StringBuilder buf2 = new StringBuilder(); ch = in.read(); do { buf2.append((char) ch); @@ -232,7 +232,7 @@ public final class Signature extends Att public static String translate( final String s ) { //System.out.println("Sig:" + s); - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); matchGJIdent(new MyByteArrayInputStream(s), buf); return buf.toString(); } @@ -255,7 +255,7 @@ public final class Signature extends Att */ @Override public final String toString() { - String s = getSignature(); + final String s = getSignature(); return "Signature: " + s; } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java Tue Jun 21 20:50:19 2016 @@ -54,7 +54,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } - ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(getIndex(), + final ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(getIndex(), Const.CONSTANT_Utf8); return c.getBytes(); } @@ -65,7 +65,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } - ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(), + final ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(), Const.CONSTANT_Integer); return c.getBytes(); } @@ -76,7 +76,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueByte() on a non BYTE ElementValue"); } - ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(), + final ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(), Const.CONSTANT_Integer); return (byte) c.getBytes(); } @@ -87,7 +87,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueChar() on a non CHAR ElementValue"); } - ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(), + final ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(), Const.CONSTANT_Integer); return (char) c.getBytes(); } @@ -98,7 +98,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueLong() on a non LONG ElementValue"); } - ConstantLong j = (ConstantLong) super.getConstantPool().getConstant(getIndex()); + final ConstantLong j = (ConstantLong) super.getConstantPool().getConstant(getIndex()); return j.getBytes(); } @@ -108,7 +108,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueFloat() on a non FLOAT ElementValue"); } - ConstantFloat f = (ConstantFloat) super.getConstantPool().getConstant(getIndex()); + final ConstantFloat f = (ConstantFloat) super.getConstantPool().getConstant(getIndex()); return f.getBytes(); } @@ -118,7 +118,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueDouble() on a non DOUBLE ElementValue"); } - ConstantDouble d = (ConstantDouble) super.getConstantPool().getConstant(getIndex()); + final ConstantDouble d = (ConstantDouble) super.getConstantPool().getConstant(getIndex()); return d.getBytes(); } @@ -128,7 +128,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueBoolean() on a non BOOLEAN ElementValue"); } - ConstantInteger bo = (ConstantInteger) super.getConstantPool().getConstant(getIndex()); + final ConstantInteger bo = (ConstantInteger) super.getConstantPool().getConstant(getIndex()); return bo.getBytes() != 0; } @@ -138,7 +138,7 @@ public class SimpleElementValue extends throw new RuntimeException( "Dont call getValueShort() on a non SHORT ElementValue"); } - ConstantInteger s = (ConstantInteger) super.getConstantPool().getConstant(getIndex()); + final ConstantInteger s = (ConstantInteger) super.getConstantPool().getConstant(getIndex()); return (short) s.getBytes(); } @@ -152,47 +152,47 @@ public class SimpleElementValue extends @Override public String stringifyValue() { - ConstantPool cpool = super.getConstantPool(); + final ConstantPool cpool = super.getConstantPool(); final int _type = super.getType(); switch (_type) { case PRIMITIVE_INT: - ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(), + final ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(), Const.CONSTANT_Integer); return Integer.toString(c.getBytes()); case PRIMITIVE_LONG: - ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), + final ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), Const.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: - ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(), + final ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(), Const.CONSTANT_Double); return Double.toString(d.getBytes()); case PRIMITIVE_FLOAT: - ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(), + final ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(), Const.CONSTANT_Float); return Float.toString(f.getBytes()); case PRIMITIVE_SHORT: - ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(), + final ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(), Const.CONSTANT_Integer); return Integer.toString(s.getBytes()); case PRIMITIVE_BYTE: - ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(), + final ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(), Const.CONSTANT_Integer); return Integer.toString(b.getBytes()); case PRIMITIVE_CHAR: - ConstantInteger ch = (ConstantInteger) cpool.getConstant( + final ConstantInteger ch = (ConstantInteger) cpool.getConstant( getIndex(), Const.CONSTANT_Integer); return String.valueOf((char)ch.getBytes()); case PRIMITIVE_BOOLEAN: - ConstantInteger bo = (ConstantInteger) cpool.getConstant( + final ConstantInteger bo = (ConstantInteger) cpool.getConstant( getIndex(), Const.CONSTANT_Integer); if (bo.getBytes() == 0) { return "false"; } return "true"; case STRING: - ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(), + final ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(), Const.CONSTANT_Utf8); return cu8.getBytes(); default: Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SourceFile.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SourceFile.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SourceFile.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/SourceFile.java Tue Jun 21 20:50:19 2016 @@ -125,7 +125,7 @@ public final class SourceFile extends At * @return Source file name. */ public final String getSourceFileName() { - ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(sourcefile_index, + final ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(sourcefile_index, Const.CONSTANT_Utf8); return c.getBytes(); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMap.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMap.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMap.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMap.java Tue Jun 21 20:50:19 2016 @@ -65,7 +65,7 @@ public final class StackMap extends Attr */ StackMap(final int name_index, final int length, final DataInput input, final ConstantPool constant_pool) throws IOException { this(name_index, length, (StackMapEntry[]) null, constant_pool); - int map_length = input.readUnsignedShort(); + final int map_length = input.readUnsignedShort(); map = new StackMapEntry[map_length]; for (int i = 0; i < map_length; i++) { map[i] = new StackMapEntry(input, constant_pool); @@ -83,7 +83,7 @@ public final class StackMap extends Attr public final void dump( final DataOutputStream file ) throws IOException { super.dump(file); file.writeShort(map.length); - for (StackMapEntry entry : map) { + for (final StackMapEntry entry : map) { entry.dump(file); } } @@ -103,7 +103,7 @@ public final class StackMap extends Attr public final void setStackMap( final StackMapEntry[] map ) { this.map = map; int len = 2; // Length of 'number_of_entries' field prior to the array of stack maps - for (StackMapEntry element : map) { + for (final StackMapEntry element : map) { len += element.getMapEntrySize(); } setLength(len); @@ -115,7 +115,7 @@ public final class StackMap extends Attr */ @Override public final String toString() { - StringBuilder buf = new StringBuilder("StackMap("); + final StringBuilder buf = new StringBuilder("StackMap("); for (int i = 0; i < map.length; i++) { buf.append(map[i]); if (i < map.length - 1) { @@ -132,7 +132,7 @@ public final class StackMap extends Attr */ @Override public Attribute copy( final ConstantPool _constant_pool ) { - StackMap c = (StackMap) clone(); + final StackMap c = (StackMap) clone(); c.map = new StackMapEntry[map.length]; for (int i = 0; i < map.length; i++) { c.map[i] = map[i].copy(); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapEntry.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapEntry.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapEntry.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapEntry.java Tue Jun 21 20:50:19 2016 @@ -67,19 +67,19 @@ public final class StackMapEntry impleme byte_code_offset = input.readShort(); } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) { byte_code_offset = input.readShort(); - int number_of_locals = frame_type - 251; + final int number_of_locals = frame_type - 251; types_of_locals = new StackMapType[number_of_locals]; for (int i = 0; i < number_of_locals; i++) { types_of_locals[i] = new StackMapType(input, constant_pool); } } else if (frame_type == Const.FULL_FRAME) { byte_code_offset = input.readShort(); - int number_of_locals = input.readShort(); + final int number_of_locals = input.readShort(); types_of_locals = new StackMapType[number_of_locals]; for (int i = 0; i < number_of_locals; i++) { types_of_locals[i] = new StackMapType(input, constant_pool); } - int number_of_stack_items = input.readShort(); + final int number_of_stack_items = input.readShort(); types_of_stack_items = new StackMapType[number_of_stack_items]; for (int i = 0; i < number_of_stack_items; i++) { types_of_stack_items[i] = new StackMapType(input, constant_pool); @@ -154,17 +154,17 @@ public final class StackMapEntry impleme file.writeShort(byte_code_offset); } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) { file.writeShort(byte_code_offset); - for (StackMapType type : types_of_locals) { + for (final StackMapType type : types_of_locals) { type.dump(file); } } else if (frame_type == Const.FULL_FRAME) { file.writeShort(byte_code_offset); file.writeShort(types_of_locals.length); - for (StackMapType type : types_of_locals) { + for (final StackMapType type : types_of_locals) { type.dump(file); } file.writeShort(types_of_stack_items.length); - for (StackMapType type : types_of_stack_items) { + for (final StackMapType type : types_of_stack_items) { type.dump(file); } } else { @@ -179,7 +179,7 @@ public final class StackMapEntry impleme */ @Override public final String toString() { - StringBuilder buf = new StringBuilder(64); + final StringBuilder buf = new StringBuilder(64); buf.append("("); if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) { buf.append("SAME"); @@ -243,16 +243,16 @@ public final class StackMapEntry impleme return 3; } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) { int len = 3; - for (StackMapType types_of_local : types_of_locals) { + for (final StackMapType types_of_local : types_of_locals) { len += types_of_local.hasIndex() ? 3 : 1; } return len; } else if (frame_type == Const.FULL_FRAME) { int len = 7; - for (StackMapType types_of_local : types_of_locals) { + for (final StackMapType types_of_local : types_of_locals) { len += types_of_local.hasIndex() ? 3 : 1; } - for (StackMapType types_of_stack_item : types_of_stack_items) { + for (final StackMapType types_of_stack_item : types_of_stack_items) { len += types_of_stack_item.hasIndex() ? 3 : 1; } return len; @@ -382,7 +382,7 @@ public final class StackMapEntry impleme StackMapEntry e; try { e = (StackMapEntry) clone(); - } catch (CloneNotSupportedException ex) { + } catch (final CloneNotSupportedException ex) { throw new Error("Clone Not Supported"); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapType.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapType.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapType.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/StackMapType.java Tue Jun 21 20:50:19 2016 @@ -143,7 +143,7 @@ public final class StackMapType implemen public StackMapType copy() { try { return (StackMapType) clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { // TODO should this throw? } return null; Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Synthetic.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Synthetic.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Synthetic.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Synthetic.java Tue Jun 21 20:50:19 2016 @@ -132,7 +132,7 @@ public final class Synthetic extends Att */ @Override public final String toString() { - StringBuilder buf = new StringBuilder("Synthetic"); + final StringBuilder buf = new StringBuilder("Synthetic"); if (super.getLength() > 0) { buf.append(" ").append(Utility.toHexString(bytes)); } @@ -145,7 +145,7 @@ public final class Synthetic extends Att */ @Override public Attribute copy( final ConstantPool _constant_pool ) { - Synthetic c = (Synthetic) clone(); + final Synthetic c = (Synthetic) clone(); if (bytes != null) { c.bytes = new byte[bytes.length]; System.arraycopy(bytes, 0, c.bytes, 0, bytes.length); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Unknown.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Unknown.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Unknown.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Unknown.java Tue Jun 21 20:50:19 2016 @@ -48,7 +48,7 @@ public final class Unknown extends Attri /** @return array of unknown attributes, but just one for each kind. */ static Unknown[] getUnknownAttributes() { - Unknown[] unknowns = new Unknown[unknown_attributes.size()]; + final Unknown[] unknowns = new Unknown[unknown_attributes.size()]; unknown_attributes.values().toArray(unknowns); unknown_attributes.clear(); return unknowns; @@ -163,7 +163,7 @@ public final class Unknown extends Attri } String hex; if (super.getLength() > 10) { - byte[] tmp = new byte[10]; + final byte[] tmp = new byte[10]; System.arraycopy(bytes, 0, tmp, 0, 10); hex = Utility.toHexString(tmp) + "... (truncated)"; } else { @@ -178,7 +178,7 @@ public final class Unknown extends Attri */ @Override public Attribute copy( final ConstantPool _constant_pool ) { - Unknown c = (Unknown) clone(); + final Unknown c = (Unknown) clone(); if (bytes != null) { c.bytes = new byte[bytes.length]; System.arraycopy(bytes, 0, c.bytes, 0, bytes.length); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java Tue Jun 21 20:50:19 2016 @@ -100,7 +100,7 @@ public abstract class Utility { * @return String representation of flags */ public static String accessToString( final int access_flags, final boolean for_class ) { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); int p = 0; for (int i = 0; p < Const.MAX_ACC_FLAG; i++) { // Loop through known flags p = pow2(i); @@ -146,18 +146,18 @@ public abstract class Utility { */ public static String codeToString( final byte[] code, final ConstantPool constant_pool, final int index, final int length, final boolean verbose ) { - StringBuilder buf = new StringBuilder(code.length * 20); // Should be sufficient // CHECKSTYLE IGNORE MagicNumber + final StringBuilder buf = new StringBuilder(code.length * 20); // Should be sufficient // CHECKSTYLE IGNORE MagicNumber try (ByteSequence stream = new ByteSequence(code)) { for (int i = 0; i < index; i++) { codeToString(stream, constant_pool, verbose); } for (int i = 0; stream.available() > 0; i++) { if ((length < 0) || (i < length)) { - String indices = fillup(stream.getIndex() + ":", 6, true, ' '); + final String indices = fillup(stream.getIndex() + ":", 6, true, ' '); buf.append(indices).append(codeToString(stream, constant_pool, verbose)).append('\n'); } } - } catch (IOException e) { + } catch (final IOException e) { throw new ClassFormatException("Byte code error: " + buf.toString(), e); } return buf.toString(); @@ -182,7 +182,7 @@ public abstract class Utility { */ public static String codeToString( final ByteSequence bytes, final ConstantPool constant_pool, final boolean verbose ) throws IOException { - short opcode = (short) bytes.readUnsignedByte(); + final short opcode = (short) bytes.readUnsignedByte(); int default_offset = 0; int low; int high; @@ -194,12 +194,12 @@ public abstract class Utility { int[] jump_table; int no_pad_bytes = 0; int offset; - StringBuilder buf = new StringBuilder(Const.getOpcodeName(opcode)); + final StringBuilder buf = new StringBuilder(Const.getOpcodeName(opcode)); /* Special case: Skip (0-3) padding bytes, i.e., the * following bytes are 4-byte-aligned */ if ((opcode == Const.TABLESWITCH) || (opcode == Const.LOOKUPSWITCH)) { - int remainder = bytes.getIndex() % 4; + final int remainder = bytes.getIndex() % 4; no_pad_bytes = (remainder == 0) ? 0 : 4 - remainder; for (int i = 0; i < no_pad_bytes; i++) { byte b; @@ -344,7 +344,7 @@ public abstract class Utility { case Const.INVOKESPECIAL: case Const.INVOKESTATIC: index = bytes.readUnsignedShort(); - Constant c = constant_pool.getConstant(index); + final Constant c = constant_pool.getConstant(index); // With Java8 operand may be either a CONSTANT_Methodref // or a CONSTANT_InterfaceMethodref. (markro) buf.append("\t").append( @@ -359,7 +359,7 @@ public abstract class Utility { break; case Const.INVOKEINTERFACE: index = bytes.readUnsignedShort(); - int nargs = bytes.readUnsignedByte(); // historical, redundant + final int nargs = bytes.readUnsignedByte(); // historical, redundant buf.append("\t").append( constant_pool .constantToString(index, Const.CONSTANT_InterfaceMethodref)) @@ -403,7 +403,7 @@ public abstract class Utility { */ case Const.MULTIANEWARRAY: { index = bytes.readUnsignedShort(); - int dimensions = bytes.readUnsignedByte(); + final int dimensions = bytes.readUnsignedByte(); buf.append("\t<").append( compactClassName(constant_pool.getConstantString(index, Const.CONSTANT_Class), false)).append(">\t").append(dimensions) @@ -477,7 +477,7 @@ public abstract class Utility { * @return Compacted class name */ public static String compactClassName( String str, final String prefix, final boolean chopit ) { - int len = prefix.length(); + final int len = prefix.length(); str = str.replace('/', '.'); // Is `/' on all systems, even DOS if (chopit) { // If string starts with `prefix' and contains no further dots @@ -516,7 +516,7 @@ public abstract class Utility { * @return `flag' with bit `i' set to 0 */ public static int clearBit( final int flag, final int i ) { - int bit = pow2(i); + final int bit = pow2(i); return (flag & bit) == 0 ? flag : flag ^ bit; } @@ -541,10 +541,10 @@ public abstract class Utility { */ public static String methodTypeToSignature( final String ret, final String[] argv ) throws ClassFormatException { - StringBuilder buf = new StringBuilder("("); + final StringBuilder buf = new StringBuilder("("); String str; if (argv != null) { - for (String element : argv) { + for (final String element : argv) { str = getSignature(element); if (str.endsWith("V")) { throw new ClassFormatException("Invalid type: " + element); @@ -577,7 +577,7 @@ public abstract class Utility { */ public static String[] methodSignatureArgumentTypes( final String signature, final boolean chopit ) throws ClassFormatException { - List<String> vec = new ArrayList<>(); + final List<String> vec = new ArrayList<>(); int index; try { // Read all declarations between for `(' and `)' if (signature.charAt(0) != '(') { @@ -589,7 +589,7 @@ public abstract class Utility { //corrected concurrent private static field acess index += unwrap(consumed_chars); // update position } - } catch (StringIndexOutOfBoundsException e) { // Should never occur + } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid method signature: " + signature, e); } return vec.toArray(new String[vec.size()]); @@ -619,7 +619,7 @@ public abstract class Utility { // Read return type after `)' index = signature.lastIndexOf(')') + 1; type = signatureToString(signature.substring(index), chopit); - } catch (StringIndexOutOfBoundsException e) { // Should never occur + } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid method signature: " + signature, e); } return type; @@ -681,7 +681,7 @@ public abstract class Utility { */ public static String methodSignatureToString( final String signature, final String name, final String access, final boolean chopit, final LocalVariableTable vars ) throws ClassFormatException { - StringBuilder buf = new StringBuilder("("); + final StringBuilder buf = new StringBuilder("("); String type; int index; int var_index = access.contains("static") ? 0 : 1; @@ -691,10 +691,10 @@ public abstract class Utility { } index = 1; // current string position while (signature.charAt(index) != ')') { - String param_type = signatureToString(signature.substring(index), chopit); + final String param_type = signatureToString(signature.substring(index), chopit); buf.append(param_type); if (vars != null) { - LocalVariable l = vars.getLocalVariable(var_index, 0); + final LocalVariable l = vars.getLocalVariable(var_index, 0); if (l != null) { buf.append(" ").append(l.getName()); } @@ -713,7 +713,7 @@ public abstract class Utility { index++; // update position // Read return type after `)' type = signatureToString(signature.substring(index), chopit); - } catch (StringIndexOutOfBoundsException e) { // Should never occur + } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid method signature: " + signature, e); } if (buf.length() > 1) { @@ -744,7 +744,7 @@ public abstract class Utility { int old_index; try { if (str.contains(old)) { // `old' found in str - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); old_index = 0; // String start offset // While we have something to replace while ((index = str.indexOf(old, old_index)) != -1) { @@ -755,7 +755,7 @@ public abstract class Utility { buf.append(str.substring(old_index)); // append rest of string str = buf.toString(); } - } catch (StringIndexOutOfBoundsException e) { // Should not occur + } catch (final StringIndexOutOfBoundsException e) { // Should not occur System.err.println(e); } return str; @@ -825,7 +825,7 @@ public abstract class Utility { case 'J': return "long"; case 'T': { // TypeVariableSignature - int index = signature.indexOf(';'); // Look for closing `;' + final int index = signature.indexOf(';'); // Look for closing `;' if (index < 0) { throw new ClassFormatException("Invalid signature: " + signature); } @@ -845,12 +845,12 @@ public abstract class Utility { throw new ClassFormatException("Invalid signature: " + signature); } } - int index = signature.indexOf(';', fromIndex); // Look for closing `;' + final int index = signature.indexOf(';', fromIndex); // Look for closing `;' if (index < 0) { throw new ClassFormatException("Invalid signature: " + signature); } // check to see if there are any TypeArguments - int bracketIndex = signature.substring(0, index).indexOf('<'); + final int bracketIndex = signature.substring(0, index).indexOf('<'); if (bracketIndex < 0) { // just a class identifier wrap(consumed_chars, index + 1); // "Lblabla;" `L' and `;' are removed @@ -859,7 +859,7 @@ public abstract class Utility { // we have TypeArguments; build up partial result // as we recurse for each TypeArgument - StringBuilder type = new StringBuilder(compactClassName(signature.substring(1, bracketIndex), chopit)).append("<"); + final StringBuilder type = new StringBuilder(compactClassName(signature.substring(1, bracketIndex), chopit)).append("<"); int consumed_chars = bracketIndex + 1; // Shadows global var // check for wildcards @@ -920,7 +920,7 @@ public abstract class Utility { type = signatureToString(signature.substring(n), chopit); //corrected concurrent private static field acess //Utility.consumed_chars += consumed_chars; is replaced by: - int _temp = unwrap(Utility.consumed_chars) + consumed_chars; + final int _temp = unwrap(Utility.consumed_chars) + consumed_chars; wrap(Utility.consumed_chars, _temp); return type + brackets.toString(); } @@ -929,7 +929,7 @@ public abstract class Utility { default: throw new ClassFormatException("Invalid signature: `" + signature + "'"); } - } catch (StringIndexOutOfBoundsException e) { // Should never occur + } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid signature: " + signature, e); } } @@ -942,8 +942,8 @@ public abstract class Utility { * @return byte code signature */ public static String getSignature( String type ) { - StringBuilder buf = new StringBuilder(); - char[] chars = type.toCharArray(); + final StringBuilder buf = new StringBuilder(); + final char[] chars = type.toCharArray(); boolean char_found = false; boolean delim = false; int index = -1; @@ -995,10 +995,10 @@ public abstract class Utility { private static int countBrackets( final String brackets ) { - char[] chars = brackets.toCharArray(); + final char[] chars = brackets.toCharArray(); int count = 0; boolean open = false; - for (char c : chars) { + for (final char c : chars) { switch (c) { case '[': if (open) { @@ -1042,7 +1042,7 @@ public abstract class Utility { } index = signature.lastIndexOf(')') + 1; return typeOfSignature(signature.substring(index)); - } catch (StringIndexOutOfBoundsException e) { + } catch (final StringIndexOutOfBoundsException e) { throw new ClassFormatException("Invalid method signature: " + signature, e); } } @@ -1086,7 +1086,7 @@ public abstract class Utility { default: throw new ClassFormatException("Invalid method signature: " + signature); } - } catch (StringIndexOutOfBoundsException e) { + } catch (final StringIndexOutOfBoundsException e) { throw new ClassFormatException("Invalid method signature: " + signature, e); } } @@ -1121,10 +1121,10 @@ public abstract class Utility { * @return bytes as hexadecimal string, e.g. 00 fa 12 ... */ public static String toHexString( final byte[] bytes ) { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { - short b = byteToShort(bytes[i]); - String hex = Integer.toHexString(b); + final short b = byteToShort(bytes[i]); + final String hex = Integer.toHexString(b); if (b < 0x10) { buf.append('0'); } @@ -1162,8 +1162,8 @@ public abstract class Utility { * @return formatted string */ public static String fillup( final String str, final int length, final boolean left_justify, final char fill ) { - int len = length - str.length(); - char[] buf = new char[(len < 0) ? 0 : len]; + final int len = length - str.length(); + final char[] buf = new char[(len < 0) ? 0 : len]; for (int j = 0; j < buf.length; j++) { buf[j] = fill; } @@ -1212,7 +1212,7 @@ public abstract class Utility { if (obj == null) { return null; } - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); if (braces) { buf.append('{'); } @@ -1272,10 +1272,10 @@ public abstract class Utility { bytes = baos.toByteArray(); } } - CharArrayWriter caw = new CharArrayWriter(); + final CharArrayWriter caw = new CharArrayWriter(); try (JavaWriter jw = new JavaWriter(caw)) { - for (byte b : bytes) { - int in = b & 0x000000ff; // Normalize to unsigned + for (final byte b : bytes) { + final int in = b & 0x000000ff; // Normalize to unsigned jw.write(in); } } @@ -1302,8 +1302,8 @@ public abstract class Utility { bytes = bos.toByteArray(); } if (uncompress) { - GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); - byte[] tmp = new byte[bytes.length * 3]; // Rough estimate + final GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); + final byte[] tmp = new byte[bytes.length * 3]; // Rough estimate int count = 0; int b; while ((b = gis.read()) >= 0) { @@ -1352,23 +1352,23 @@ public abstract class Utility { @Override public int read() throws IOException { - int b = in.read(); + final int b = in.read(); if (b != ESCAPE_CHAR) { return b; } - int i = in.read(); + final int i = in.read(); if (i < 0) { return -1; } if (((i >= '0') && (i <= '9')) || ((i >= 'a') && (i <= 'f'))) { // Normal escape - int j = in.read(); + final int j = in.read(); if (j < 0) { return -1; } - char[] tmp = { + final char[] tmp = { (char) i, (char) j }; - int s = Integer.parseInt(new String(tmp), 16); + final int s = Integer.parseInt(new String(tmp), 16); return s; } return MAP_CHAR[i]; @@ -1405,7 +1405,7 @@ public abstract class Utility { if (b >= 0 && b < FREE_CHARS) { out.write(CHAR_MAP[b]); } else { // Normal escape - char[] tmp = Integer.toHexString(b).toCharArray(); + final char[] tmp = Integer.toHexString(b).toCharArray(); if (tmp.length == 1) { out.write('0'); out.write(tmp[0]); @@ -1437,9 +1437,9 @@ public abstract class Utility { * Escape all occurences of newline chars '\n', quotes \", etc. */ public static String convertString( final String label ) { - char[] ch = label.toCharArray(); - StringBuilder buf = new StringBuilder(); - for (char element : ch) { + final char[] ch = label.toCharArray(); + final StringBuilder buf = new StringBuilder(); + for (final char element : ch) { switch (element) { case '\n': buf.append("\\n"); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java Tue Jun 21 20:50:19 2016 @@ -69,8 +69,8 @@ public class AnnotationEntryGen { private List<ElementValuePairGen> copyValues(final ElementValuePair[] in, final ConstantPoolGen cpool, final boolean copyPoolEntries) { - List<ElementValuePairGen> out = new ArrayList<>(); - for (ElementValuePair nvp : in) { + final List<ElementValuePairGen> out = new ArrayList<>(); + for (final ElementValuePair nvp : in) { out.add(new ElementValuePairGen(nvp, cpool, copyPoolEntries)); } return out; @@ -84,9 +84,9 @@ public class AnnotationEntryGen { * Retrieve an immutable version of this AnnotationGen */ public AnnotationEntry getAnnotation() { - AnnotationEntry a = new AnnotationEntry(typeIndex, cpool.getConstantPool(), + final AnnotationEntry a = new AnnotationEntry(typeIndex, cpool.getConstantPool(), isRuntimeVisible); - for (ElementValuePairGen element : evs) { + for (final ElementValuePairGen element : evs) { a.addElementNameValuePair(element.getElementNameValuePair()); } return a; @@ -103,11 +103,11 @@ public class AnnotationEntryGen { public static AnnotationEntryGen read(final DataInput dis, final ConstantPoolGen cpool, final boolean b) throws IOException { - AnnotationEntryGen a = new AnnotationEntryGen(cpool); + final AnnotationEntryGen a = new AnnotationEntryGen(cpool); a.typeIndex = dis.readUnsignedShort(); - int elemValuePairCount = dis.readUnsignedShort(); + final int elemValuePairCount = dis.readUnsignedShort(); for (int i = 0; i < elemValuePairCount; i++) { - int nidx = dis.readUnsignedShort(); + final int nidx = dis.readUnsignedShort(); a.addElementNameValuePair(new ElementValuePairGen(nidx, ElementValueGen.readElementValue(dis, cpool), cpool)); } @@ -118,7 +118,7 @@ public class AnnotationEntryGen { public void dump(final DataOutputStream dos) throws IOException { dos.writeShort(typeIndex); // u2 index of type name in cpool dos.writeShort(evs.size()); // u2 element_value pair count - for (ElementValuePairGen envp : evs) { + for (final ElementValuePairGen envp : evs) { envp.dump(dos); } } @@ -136,7 +136,7 @@ public class AnnotationEntryGen { public final String getTypeSignature() { // ConstantClass c = (ConstantClass)cpool.getConstant(typeIndex); - ConstantUtf8 utf8 = (ConstantUtf8) cpool + final ConstantUtf8 utf8 = (ConstantUtf8) cpool .getConstant(typeIndex/* c.getNameIndex() */); return utf8.getBytes(); } @@ -155,7 +155,7 @@ public class AnnotationEntryGen { @Override public String toString() { - StringBuilder s = new StringBuilder(32); // CHECKSTYLE IGNORE MagicNumber + final StringBuilder s = new StringBuilder(32); // CHECKSTYLE IGNORE MagicNumber s.append("AnnotationGen:[").append(getTypeName()).append(" #").append(evs.size()).append(" {"); for (int i = 0; i < evs.size(); i++) { s.append(evs.get(i)); @@ -168,7 +168,7 @@ public class AnnotationEntryGen { } public String toShortString() { - StringBuilder s = new StringBuilder(); + final StringBuilder s = new StringBuilder(); s.append("@").append(getTypeName()).append("("); for (int i = 0; i < evs.size(); i++) { s.append(evs.get(i)); @@ -206,7 +206,7 @@ public class AnnotationEntryGen { int countInvisible = 0; // put the annotations in the right output stream - for (AnnotationEntryGen a : annotationEntryGens) { + for (final AnnotationEntryGen a : annotationEntryGens) { if (a.isRuntimeVisible()) { countVisible++; } else { @@ -214,8 +214,8 @@ public class AnnotationEntryGen { } } - ByteArrayOutputStream rvaBytes = new ByteArrayOutputStream(); - ByteArrayOutputStream riaBytes = new ByteArrayOutputStream(); + final ByteArrayOutputStream rvaBytes = new ByteArrayOutputStream(); + final ByteArrayOutputStream riaBytes = new ByteArrayOutputStream(); try (DataOutputStream rvaDos = new DataOutputStream(rvaBytes); DataOutputStream riaDos = new DataOutputStream(riaBytes)) { @@ -223,7 +223,7 @@ public class AnnotationEntryGen { riaDos.writeShort(countInvisible); // put the annotations in the right output stream - for (AnnotationEntryGen a : annotationEntryGens) { + for (final AnnotationEntryGen a : annotationEntryGens) { if (a.isRuntimeVisible()) { a.dump(rvaDos); } else { @@ -232,8 +232,8 @@ public class AnnotationEntryGen { } } - byte[] rvaData = rvaBytes.toByteArray(); - byte[] riaData = riaBytes.toByteArray(); + final byte[] rvaData = rvaBytes.toByteArray(); + final byte[] riaData = riaBytes.toByteArray(); int rvaIndex = -1; int riaIndex = -1; @@ -245,7 +245,7 @@ public class AnnotationEntryGen { riaIndex = cp.addUtf8("RuntimeInvisibleAnnotations"); } - List<Attribute> newAttributes = new ArrayList<>(); + final List<Attribute> newAttributes = new ArrayList<>(); if (rvaData.length > 2) { newAttributes.add( new RuntimeVisibleAnnotations(rvaIndex, rvaData.length, @@ -258,7 +258,7 @@ public class AnnotationEntryGen { } return newAttributes.toArray(new Attribute[newAttributes.size()]); - } catch (IOException e) { + } catch (final IOException e) { System.err.println("IOException whilst processing annotations"); e.printStackTrace(); } @@ -274,14 +274,14 @@ public class AnnotationEntryGen { static Attribute[] getParameterAnnotationAttributes( final ConstantPoolGen cp, final List<AnnotationEntryGen>[] /*Array of lists, array size depends on #params */vec) { - int[] visCount = new int[vec.length]; + final int[] visCount = new int[vec.length]; int totalVisCount = 0; - int[] invisCount = new int[vec.length]; + final int[] invisCount = new int[vec.length]; int totalInvisCount = 0; try { for (int i = 0; i < vec.length; i++) { if (vec[i] != null) { - for (AnnotationEntryGen element : vec[i]) { + for (final AnnotationEntryGen element : vec[i]) { if (element.isRuntimeVisible()) { visCount[i]++; totalVisCount++; @@ -293,13 +293,13 @@ public class AnnotationEntryGen { } } // Lets do the visible ones - ByteArrayOutputStream rvaBytes = new ByteArrayOutputStream(); + final ByteArrayOutputStream rvaBytes = new ByteArrayOutputStream(); try (DataOutputStream rvaDos = new DataOutputStream(rvaBytes)) { rvaDos.writeByte(vec.length); // First goes number of parameters for (int i = 0; i < vec.length; i++) { rvaDos.writeShort(visCount[i]); if (visCount[i] > 0) { - for (AnnotationEntryGen element : vec[i]) { + for (final AnnotationEntryGen element : vec[i]) { if (element.isRuntimeVisible()) { element.dump(rvaDos); } @@ -308,13 +308,13 @@ public class AnnotationEntryGen { } } // Lets do the invisible ones - ByteArrayOutputStream riaBytes = new ByteArrayOutputStream(); + final ByteArrayOutputStream riaBytes = new ByteArrayOutputStream(); try (DataOutputStream riaDos = new DataOutputStream(riaBytes)) { riaDos.writeByte(vec.length); // First goes number of parameters for (int i = 0; i < vec.length; i++) { riaDos.writeShort(invisCount[i]); if (invisCount[i] > 0) { - for (AnnotationEntryGen element : vec[i]) { + for (final AnnotationEntryGen element : vec[i]) { if (!element.isRuntimeVisible()) { element.dump(riaDos); } @@ -322,8 +322,8 @@ public class AnnotationEntryGen { } } } - byte[] rvaData = rvaBytes.toByteArray(); - byte[] riaData = riaBytes.toByteArray(); + final byte[] rvaData = rvaBytes.toByteArray(); + final byte[] riaData = riaBytes.toByteArray(); int rvaIndex = -1; int riaIndex = -1; if (totalVisCount > 0) { @@ -332,7 +332,7 @@ public class AnnotationEntryGen { if (totalInvisCount > 0) { riaIndex = cp.addUtf8("RuntimeInvisibleParameterAnnotations"); } - List<Attribute> newAttributes = new ArrayList<>(); + final List<Attribute> newAttributes = new ArrayList<>(); if (totalVisCount > 0) { newAttributes .add(new RuntimeVisibleParameterAnnotations(rvaIndex, @@ -344,7 +344,7 @@ public class AnnotationEntryGen { riaData.length, new DataInputStream(new ByteArrayInputStream(riaData)), cp.getConstantPool())); } return newAttributes.toArray(new Attribute[newAttributes.size()]); - } catch (IOException e) { + } catch (final IOException e) { System.err .println("IOException whilst processing parameter annotations"); e.printStackTrace(); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayElementValueGen.java Tue Jun 21 20:50:19 2016 @@ -49,7 +49,7 @@ public class ArrayElementValueGen extend "Only element values of type array can be built with this ctor - type specified: " + type); } this.evalues = new ArrayList<>(); - for (ElementValue datum : datums) { + for (final ElementValue datum : datums) { evalues.add(ElementValueGen.copy(datum, cpool, true)); } } @@ -60,9 +60,9 @@ public class ArrayElementValueGen extend @Override public ElementValue getElementValue() { - ElementValue[] immutableData = new ElementValue[evalues.size()]; + final ElementValue[] immutableData = new ElementValue[evalues.size()]; int i = 0; - for (ElementValueGen element : evalues) { + for (final ElementValueGen element : evalues) { immutableData[i++] = element.getElementValue(); } return new ArrayElementValue(super.getElementValueType(), @@ -79,8 +79,8 @@ public class ArrayElementValueGen extend { super(ARRAY, cpool); evalues = new ArrayList<>(); - ElementValue[] in = value.getElementValuesArray(); - for (ElementValue element : in) { + final ElementValue[] in = value.getElementValuesArray(); + for (final ElementValue element : in) { evalues.add(ElementValueGen.copy(element, cpool, copyPoolEntries)); } } @@ -90,7 +90,7 @@ public class ArrayElementValueGen extend { dos.writeByte(super.getElementValueType()); // u1 type of value (ARRAY == '[') dos.writeShort(evalues.size()); - for (ElementValueGen element : evalues) { + for (final ElementValueGen element : evalues) { element.dump(dos); } } @@ -98,10 +98,10 @@ public class ArrayElementValueGen extend @Override public String stringifyValue() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("["); String comma = ""; - for (ElementValueGen element : evalues) { + for (final ElementValueGen element : evalues) { sb.append(comma); comma = ","; sb.append(element.stringifyValue()); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayType.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayType.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayType.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ArrayType.java Tue Jun 21 20:50:19 2016 @@ -62,7 +62,7 @@ public final class ArrayType extends Ref } switch (type.getType()) { case Const.T_ARRAY: - ArrayType array = (ArrayType) type; + final ArrayType array = (ArrayType) type; this.dimensions = dimensions + array.dimensions; basic_type = array.basic_type; break; @@ -73,7 +73,7 @@ public final class ArrayType extends Ref basic_type = type; break; } - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < this.dimensions; i++) { buf.append('['); } @@ -121,7 +121,7 @@ public final class ArrayType extends Ref @Override public boolean equals( final Object _type ) { if (_type instanceof ArrayType) { - ArrayType array = (ArrayType) _type; + final ArrayType array = (ArrayType) _type; return (array.dimensions == dimensions) && array.basic_type.equals(basic_type); } return false; Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchHandle.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchHandle.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchHandle.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchHandle.java Tue Jun 21 20:50:19 2016 @@ -49,7 +49,7 @@ public final class BranchHandle extends if (bh_list == null) { return new BranchHandle(i); } - BranchHandle bh = bh_list; + final BranchHandle bh = bh_list; bh_list = (BranchHandle) bh.getNext(); bh.setInstruction(i); return bh; @@ -85,7 +85,7 @@ public final class BranchHandle extends @Override protected int updatePosition( final int offset, final int max_offset ) { - int x = bi.updatePosition(offset, max_offset); + final int x = bi.updatePosition(offset, max_offset); super.setPosition(bi.getPosition()); return x; } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchInstruction.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchInstruction.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchInstruction.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/BranchInstruction.java Tue Jun 21 20:50:19 2016 @@ -93,7 +93,7 @@ public abstract class BranchInstruction throw new ClassGenException("Target of " + super.toString(true) + " is invalid null handle"); } - int t = _target.getPosition(); + final int t = _target.getPosition(); if (t < 0) { throw new ClassGenException("Invalid branch target position offset for " + super.toString(true) + ":" + t + ":" + _target); @@ -139,7 +139,7 @@ public abstract class BranchInstruction */ @Override public String toString( final boolean verbose ) { - String s = super.toString(verbose); + final String s = super.toString(verbose); String t = "null"; if (verbose) { if (target != null) { Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/CPInstruction.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/CPInstruction.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/CPInstruction.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/CPInstruction.java Tue Jun 21 20:50:19 2016 @@ -93,7 +93,7 @@ public abstract class CPInstruction exte */ @Override public String toString( final ConstantPool cp ) { - Constant c = cp.getConstant(index); + final Constant c = cp.getConstant(index); String str = cp.constantToString(c); if (c instanceof ConstantClass) { str = str.replace('.', '/'); @@ -140,7 +140,7 @@ public abstract class CPInstruction exte */ @Override public Type getType( final ConstantPoolGen cpg ) { - ConstantPool cp = cpg.getConstantPool(); + final ConstantPool cp = cpg.getConstantPool(); String name = cp.getConstantString(index, org.apache.bcel.Const.CONSTANT_Class); if (!name.startsWith("[")) { name = "L" + name + ";"; Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassElementValueGen.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassElementValueGen.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassElementValueGen.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassElementValueGen.java Tue Jun 21 20:50:19 2016 @@ -80,7 +80,7 @@ public class ClassElementValueGen extend public String getClassString() { - ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); + final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); return cu8.getBytes(); // ConstantClass c = (ConstantClass)getConstantPool().getConstant(idx); // ConstantUtf8 utf8 =