Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java Tue Jun 21 20:50:19 2016 @@ -79,8 +79,8 @@ public class MethodGen extends FieldGenO @Override public boolean equals( final Object o1, final Object o2 ) { - MethodGen THIS = (MethodGen) o1; - MethodGen THAT = (MethodGen) o2; + final MethodGen THIS = (MethodGen) o1; + final MethodGen THAT = (MethodGen) o2; return THIS.getName().equals(THAT.getName()) && THIS.getSignature().equals(THAT.getSignature()); } @@ -88,7 +88,7 @@ public class MethodGen extends FieldGenO @Override public int hashCode( final Object o ) { - MethodGen THIS = (MethodGen) o; + final MethodGen THIS = (MethodGen) o; return THIS.getSignature().hashCode() ^ THIS.getName().hashCode(); } }; @@ -126,7 +126,7 @@ public class MethodGen extends FieldGenO setClassName(class_name); setInstructionList(il); setConstantPool(cp); - boolean abstract_ = isAbstract() || isNative(); + final boolean abstract_ = isAbstract() || isNative(); InstructionHandle start = null; InstructionHandle end = null; if (!abstract_) { @@ -139,8 +139,8 @@ public class MethodGen extends FieldGenO } } if (arg_types != null) { - int size = arg_types.length; - for (Type arg_type : arg_types) { + final int size = arg_types.length; + for (final Type arg_type : arg_types) { if (Type.VOID == arg_type) { throw new ClassGenException("'void' is an illegal argument type for a method"); } @@ -180,25 +180,25 @@ public class MethodGen extends FieldGenO ((m.getAccessFlags() & (Const.ACC_ABSTRACT | Const.ACC_NATIVE)) == 0) ? new InstructionList(m.getCode().getCode()) : null, cp); - Attribute[] attributes = m.getAttributes(); - for (Attribute attribute : attributes) { + final Attribute[] attributes = m.getAttributes(); + for (final Attribute attribute : attributes) { Attribute a = attribute; if (a instanceof Code) { - Code c = (Code) a; + final Code c = (Code) a; setMaxStack(c.getMaxStack()); setMaxLocals(c.getMaxLocals()); - CodeException[] ces = c.getExceptionTable(); + final CodeException[] ces = c.getExceptionTable(); if (ces != null) { - for (CodeException ce : ces) { - int type = ce.getCatchType(); + for (final CodeException ce : ces) { + final int type = ce.getCatchType(); ObjectType c_type = null; if (type > 0) { - String cen = m.getConstantPool().getConstantString(type, + final String cen = m.getConstantPool().getConstantString(type, Const.CONSTANT_Class); c_type = ObjectType.getInstance(cen); } - int end_pc = ce.getEndPC(); - int length = m.getCode().getCode().length; + final int end_pc = ce.getEndPC(); + final int length = m.getCode().getCode().length; InstructionHandle end; if (length == end_pc) { // May happen, because end_pc is exclusive end = il.getEnd(); @@ -210,21 +210,21 @@ public class MethodGen extends FieldGenO .getHandlerPC()), c_type); } } - Attribute[] c_attributes = c.getAttributes(); - for (Attribute c_attribute : c_attributes) { + final Attribute[] c_attributes = c.getAttributes(); + for (final Attribute c_attribute : c_attributes) { a = c_attribute; if (a instanceof LineNumberTable) { - LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable(); - for (LineNumber l : ln) { - InstructionHandle ih = il.findHandle(l.getStartPC()); + final LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable(); + for (final LineNumber l : ln) { + final InstructionHandle ih = il.findHandle(l.getStartPC()); if (ih != null) { addLineNumber(ih, l.getLineNumber()); } } } else if (a instanceof LocalVariableTable) { - LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable(); + final LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable(); removeLocalVariables(); - for (LocalVariable l : lv) { + for (final LocalVariable l : lv) { InstructionHandle start = il.findHandle(l.getStartPC()); InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength()); // Repair malformed handles @@ -242,14 +242,14 @@ public class MethodGen extends FieldGenO } } } else if (a instanceof ExceptionTable) { - String[] names = ((ExceptionTable) a).getExceptionNames(); - for (String name2 : names) { + final String[] names = ((ExceptionTable) a).getExceptionNames(); + for (final String name2 : names) { addException(name2); } } else if (a instanceof Annotations) { - Annotations runtimeAnnotations = (Annotations) a; - AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries(); - for (AnnotationEntry element : aes) { + final Annotations runtimeAnnotations = (Annotations) a; + final AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries(); + for (final AnnotationEntry element : aes) { addAnnotationEntry(new AnnotationEntryGen(element, cp, false)); } } else { @@ -273,13 +273,13 @@ public class MethodGen extends FieldGenO */ public LocalVariableGen addLocalVariable( final String name, final Type type, final int slot, final InstructionHandle start, final InstructionHandle end ) { - byte t = type.getType(); + final byte t = type.getType(); if (t != Const.T_ADDRESS) { - int add = type.getSize(); + final int add = type.getSize(); if (slot + add > max_locals) { max_locals = slot + add; } - LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end); + final LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end); int i; if ((i = variable_vec.indexOf(l)) >= 0) { variable_vec.set(i, l); @@ -325,7 +325,7 @@ public class MethodGen extends FieldGenO * Remove all local variables. */ public void removeLocalVariables() { - for (LocalVariableGen lv : variable_vec) { + for (final LocalVariableGen lv : variable_vec) { lv.dispose(); } variable_vec.clear(); @@ -339,8 +339,8 @@ public class MethodGen extends FieldGenO * @return array of declared local variables sorted by index */ public LocalVariableGen[] getLocalVariables() { - int size = variable_vec.size(); - LocalVariableGen[] lg = new LocalVariableGen[size]; + final int size = variable_vec.size(); + final LocalVariableGen[] lg = new LocalVariableGen[size]; variable_vec.toArray(lg); for (int i = 0; i < size; i++) { if ((lg[i].getStart() == null) && (il != null)) { @@ -366,9 +366,9 @@ public class MethodGen extends FieldGenO * @return `LocalVariableTable' attribute of all the local variables of this method. */ public LocalVariableTable getLocalVariableTable( final ConstantPoolGen cp ) { - LocalVariableGen[] lg = getLocalVariables(); - int size = lg.length; - LocalVariable[] lv = new LocalVariable[size]; + final LocalVariableGen[] lg = getLocalVariables(); + final int size = lg.length; + final LocalVariable[] lv = new LocalVariable[size]; for (int i = 0; i < size; i++) { lv[i] = lg[i].getLocalVariable(cp); } @@ -385,7 +385,7 @@ public class MethodGen extends FieldGenO * @see LineNumber */ public LineNumberGen addLineNumber( final InstructionHandle ih, final int src_line ) { - LineNumberGen l = new LineNumberGen(ih, src_line); + final LineNumberGen l = new LineNumberGen(ih, src_line); line_number_vec.add(l); return l; } @@ -411,7 +411,7 @@ public class MethodGen extends FieldGenO * @return array of line numbers */ public LineNumberGen[] getLineNumbers() { - LineNumberGen[] lg = new LineNumberGen[line_number_vec.size()]; + final LineNumberGen[] lg = new LineNumberGen[line_number_vec.size()]; line_number_vec.toArray(lg); return lg; } @@ -421,8 +421,8 @@ public class MethodGen extends FieldGenO * @return `LineNumberTable' attribute of all the local variables of this method. */ public LineNumberTable getLineNumberTable( final ConstantPoolGen cp ) { - int size = line_number_vec.size(); - LineNumber[] ln = new LineNumber[size]; + final int size = line_number_vec.size(); + final LineNumber[] ln = new LineNumber[size]; for (int i = 0; i < size; i++) { ln[i] = line_number_vec.get(i).getLineNumber(); } @@ -447,7 +447,7 @@ public class MethodGen extends FieldGenO if ((start_pc == null) || (end_pc == null) || (handler_pc == null)) { throw new ClassGenException("Exception handler target is null instruction"); } - CodeExceptionGen c = new CodeExceptionGen(start_pc, end_pc, handler_pc, catch_type); + final CodeExceptionGen c = new CodeExceptionGen(start_pc, end_pc, handler_pc, catch_type); exception_vec.add(c); return c; } @@ -473,7 +473,7 @@ public class MethodGen extends FieldGenO * @return array of declared exception handlers */ public CodeExceptionGen[] getExceptionHandlers() { - CodeExceptionGen[] cg = new CodeExceptionGen[exception_vec.size()]; + final CodeExceptionGen[] cg = new CodeExceptionGen[exception_vec.size()]; exception_vec.toArray(cg); return cg; } @@ -483,10 +483,10 @@ public class MethodGen extends FieldGenO * @return code exceptions for `Code' attribute */ private CodeException[] getCodeExceptions() { - int size = exception_vec.size(); - CodeException[] c_exc = new CodeException[size]; + final int size = exception_vec.size(); + final CodeException[] c_exc = new CodeException[size]; for (int i = 0; i < size; i++) { - CodeExceptionGen c = exception_vec.get(i); + final CodeExceptionGen c = exception_vec.get(i); c_exc[i] = c.getCodeException(super.getConstantPool()); } return c_exc; @@ -523,7 +523,7 @@ public class MethodGen extends FieldGenO * @return array of thrown exceptions */ public String[] getExceptions() { - String[] e = new String[throws_vec.size()]; + final String[] e = new String[throws_vec.size()]; throws_vec.toArray(e); return e; } @@ -533,8 +533,8 @@ public class MethodGen extends FieldGenO * @return `Exceptions' attribute of all the exceptions thrown by this method. */ private ExceptionTable getExceptionTable( final ConstantPoolGen cp ) { - int size = throws_vec.size(); - int[] ex = new int[size]; + final int size = throws_vec.size(); + final int[] ex = new int[size]; for (int i = 0; i < size; i++) { ex[i] = cp.addClass(throws_vec.get(i)); } @@ -576,7 +576,7 @@ public class MethodGen extends FieldGenO * @return all attributes of this method. */ public Attribute[] getCodeAttributes() { - Attribute[] attributes = new Attribute[code_attrs_vec.size()]; + final Attribute[] attributes = new Attribute[code_attrs_vec.size()]; code_attrs_vec.toArray(attributes); return attributes; } @@ -585,8 +585,8 @@ public class MethodGen extends FieldGenO * @since 6.0 */ public void addAnnotationsAsAttribute(final ConstantPoolGen cp) { - Attribute[] attrs = AnnotationEntryGen.getAnnotationAttributes(cp, super.getAnnotationEntries()); - for (Attribute attr : attrs) { + final Attribute[] attrs = AnnotationEntryGen.getAnnotationAttributes(cp, super.getAnnotationEntries()); + for (final Attribute attr : attrs) { addAttribute(attr); } } @@ -598,9 +598,9 @@ public class MethodGen extends FieldGenO if (!hasParameterAnnotations) { return; } - Attribute[] attrs = AnnotationEntryGen.getParameterAnnotationAttributes(cp,param_annotations); + final Attribute[] attrs = AnnotationEntryGen.getParameterAnnotationAttributes(cp,param_annotations); if (attrs!=null) { - for (Attribute attr : attrs) { + for (final Attribute attr : attrs) { addAttribute(attr); } } @@ -614,10 +614,10 @@ public class MethodGen extends FieldGenO * @return method object */ public Method getMethod() { - String signature = getSignature(); + final String signature = getSignature(); final ConstantPoolGen _cp = super.getConstantPool(); - int name_index = _cp.addUtf8(super.getName()); - int signature_index = _cp.addUtf8(signature); + final int name_index = _cp.addUtf8(super.getName()); + final int signature_index = _cp.addUtf8(signature); /* Also updates positions of instructions, i.e., their indices */ byte[] byte_code = null; @@ -634,20 +634,20 @@ public class MethodGen extends FieldGenO if ((line_number_vec.size() > 0) && !strip_attributes) { addCodeAttribute(lnt = getLineNumberTable(_cp)); } - Attribute[] code_attrs = getCodeAttributes(); + final Attribute[] code_attrs = getCodeAttributes(); /* Each attribute causes 6 additional header bytes */ int attrs_len = 0; - for (Attribute code_attr : code_attrs) { + for (final Attribute code_attr : code_attrs) { attrs_len += code_attr.getLength() + 6; } - CodeException[] c_exc = getCodeExceptions(); - int exc_len = c_exc.length * 8; // Every entry takes 8 bytes + final CodeException[] c_exc = getCodeExceptions(); + final int exc_len = c_exc.length * 8; // Every entry takes 8 bytes Code code = null; if ((il != null) && !isAbstract() && !isNative()) { // Remove any stale code attribute - Attribute[] attributes = getAttributes(); - for (Attribute a : attributes) { + final Attribute[] attributes = getAttributes(); + for (final Attribute a : attributes) { if (a instanceof Code) { removeAttribute(a); } @@ -665,7 +665,7 @@ public class MethodGen extends FieldGenO addAttribute(et = getExceptionTable(_cp)); // Add `Exceptions' if there are "throws" clauses } - Method m = new Method(super.getAccessFlags(), name_index, signature_index, getAttributes(), _cp + final Method m = new Method(super.getAccessFlags(), name_index, signature_index, getAttributes(), _cp .getConstantPool()); // Undo effects of adding attributes if (lvt != null) { @@ -699,9 +699,9 @@ public class MethodGen extends FieldGenO if ((next != null) && (ih.getInstruction() instanceof NOP)) { try { il.delete(ih); - } catch (TargetLostException e) { - for (InstructionHandle target : e.getTargets()) { - for (InstructionTargeter targeter : target.getTargeters()) { + } catch (final TargetLostException e) { + for (final InstructionHandle target : e.getTargets()) { + for (final InstructionTargeter targeter : target.getTargeters()) { targeter.updateTarget(target, next); } } @@ -835,15 +835,15 @@ public class MethodGen extends FieldGenO if (il != null) { int max = isStatic() ? 0 : 1; if (arg_types != null) { - for (Type arg_type : arg_types) { + for (final Type arg_type : arg_types) { max += arg_type.getSize(); } } for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) { - Instruction ins = ih.getInstruction(); + final Instruction ins = ih.getInstruction(); if ((ins instanceof LocalVariableInstruction) || (ins instanceof RET) || (ins instanceof IINC)) { - int index = ((IndexedInstruction) ins).getIndex() + final int index = ((IndexedInstruction) ins).getIndex() + ((TypedInstruction) ins).getType(super.getConstantPool()).getSize(); if (index > max) { max = index; @@ -892,7 +892,7 @@ public class MethodGen extends FieldGenO public BranchTarget pop() { if (!branchTargets.empty()) { - BranchTarget bt = branchTargets.pop(); + final BranchTarget bt = branchTargets.pop(); return bt; } return null; @@ -900,7 +900,7 @@ public class MethodGen extends FieldGenO private BranchTarget visit( final InstructionHandle target, final int stackDepth ) { - BranchTarget bt = new BranchTarget(target, stackDepth); + final BranchTarget bt = new BranchTarget(target, stackDepth); visitedTargets.put(target, bt); return bt; } @@ -918,14 +918,14 @@ public class MethodGen extends FieldGenO * @return maximum stack depth used by method */ public static int getMaxStack( final ConstantPoolGen cp, final InstructionList il, final CodeExceptionGen[] et ) { - BranchStack branchTargets = new BranchStack(); + final BranchStack branchTargets = new BranchStack(); /* Initially, populate the branch stack with the exception * handlers, because these aren't (necessarily) branched to * explicitly. in each case, the stack will have depth 1, * containing the exception object. */ - for (CodeExceptionGen element : et) { - InstructionHandle handler_pc = element.getHandlerPC(); + for (final CodeExceptionGen element : et) { + final InstructionHandle handler_pc = element.getHandlerPC(); if (handler_pc != null) { branchTargets.push(handler_pc, 1); } @@ -934,21 +934,21 @@ public class MethodGen extends FieldGenO int maxStackDepth = 0; InstructionHandle ih = il.getStart(); while (ih != null) { - Instruction instruction = ih.getInstruction(); - short opcode = instruction.getOpcode(); - int delta = instruction.produceStack(cp) - instruction.consumeStack(cp); + final Instruction instruction = ih.getInstruction(); + final short opcode = instruction.getOpcode(); + final int delta = instruction.produceStack(cp) - instruction.consumeStack(cp); stackDepth += delta; if (stackDepth > maxStackDepth) { maxStackDepth = stackDepth; } // choose the next instruction based on whether current is a branch. if (instruction instanceof BranchInstruction) { - BranchInstruction branch = (BranchInstruction) instruction; + final BranchInstruction branch = (BranchInstruction) instruction; if (instruction instanceof Select) { // explore all of the select's targets. the default target is handled below. - Select select = (Select) branch; - InstructionHandle[] targets = select.getTargets(); - for (InstructionHandle target : targets) { + final Select select = (Select) branch; + final InstructionHandle[] targets = select.getTargets(); + for (final InstructionHandle target : targets) { branchTargets.push(target, stackDepth); } // nothing to fall through to. @@ -978,7 +978,7 @@ public class MethodGen extends FieldGenO } // if we have no more instructions, see if there are any deferred branches to explore. if (ih == null) { - BranchTarget bt = branchTargets.pop(); + final BranchTarget bt = branchTargets.pop(); if (bt != null) { ih = bt.target; stackDepth = bt.stackDepth; @@ -1016,7 +1016,7 @@ public class MethodGen extends FieldGenO */ public void update() { if (observers != null) { - for (MethodObserver observer : observers) { + for (final MethodObserver observer : observers) { observer.notify(this); } } @@ -1031,19 +1031,19 @@ public class MethodGen extends FieldGenO */ @Override public final String toString() { - String access = Utility.accessToString(super.getAccessFlags()); + final String access = Utility.accessToString(super.getAccessFlags()); String signature = Type.getMethodSignature(super.getType(), arg_types); signature = Utility.methodSignatureToString(signature, super.getName(), access, true, getLocalVariableTable(super.getConstantPool())); - StringBuilder buf = new StringBuilder(signature); - for (Attribute a : getAttributes()) { + final StringBuilder buf = new StringBuilder(signature); + for (final Attribute a : getAttributes()) { if (!((a instanceof Code) || (a instanceof ExceptionTable))) { buf.append(" [").append(a).append("]"); } } if (throws_vec.size() > 0) { - for (String throwsDescriptor : throws_vec) { + for (final String throwsDescriptor : throws_vec) { buf.append("\n\t\tthrows ").append(throwsDescriptor); } } @@ -1054,8 +1054,8 @@ public class MethodGen extends FieldGenO /** @return deep copy of this method */ public MethodGen copy( final String class_name, final ConstantPoolGen cp ) { - Method m = ((MethodGen) clone()).getMethod(); - MethodGen mg = new MethodGen(m, class_name, super.getConstantPool()); + final Method m = ((MethodGen) clone()).getMethod(); + final MethodGen mg = new MethodGen(m, class_name, super.getConstantPool()); if (super.getConstantPool() != cp) { mg.setConstantPool(cp); mg.getInstructionList().replaceConstantPool(super.getConstantPool(), cp); @@ -1091,10 +1091,10 @@ public class MethodGen extends FieldGenO return; } // Find attributes that contain parameter annotation data - Attribute[] attrs = getAttributes(); + final Attribute[] attrs = getAttributes(); ParameterAnnotations paramAnnVisAttr = null; ParameterAnnotations paramAnnInvisAttr = null; - for (Attribute attribute : attrs) { + for (final Attribute attribute : attrs) { if (attribute instanceof ParameterAnnotations) { // Initialize param_annotations @@ -1108,7 +1108,7 @@ public class MethodGen extends FieldGenO } } hasParameterAnnotations = true; - ParameterAnnotations rpa = (ParameterAnnotations) attribute; + final ParameterAnnotations rpa = (ParameterAnnotations) attribute; if (rpa instanceof RuntimeVisibleParameterAnnotations) { paramAnnVisAttr = rpa; } else { @@ -1117,10 +1117,10 @@ public class MethodGen extends FieldGenO for (int j = 0; j < arg_types.length; j++) { // This returns Annotation[] ... - ParameterAnnotationEntry immutableArray = rpa + final ParameterAnnotationEntry immutableArray = rpa .getParameterAnnotationEntries()[j]; // ... which needs transforming into an AnnotationGen[] ... - List<AnnotationEntryGen> mutable = makeMutableVersion(immutableArray.getAnnotationEntries()); + final List<AnnotationEntryGen> mutable = makeMutableVersion(immutableArray.getAnnotationEntries()); // ... then add these to any we already know about param_annotations[j].addAll(mutable); } @@ -1137,8 +1137,8 @@ public class MethodGen extends FieldGenO private List<AnnotationEntryGen> makeMutableVersion(final AnnotationEntry[] mutableArray) { - List<AnnotationEntryGen> result = new ArrayList<>(); - for (AnnotationEntry element : mutableArray) { + final List<AnnotationEntryGen> result = new ArrayList<>(); + for (final AnnotationEntry element : mutableArray) { result.add(new AnnotationEntryGen(element, getConstantPool(), false)); } @@ -1156,14 +1156,14 @@ public class MethodGen extends FieldGenO param_annotations = parmList; hasParameterAnnotations = true; } - List<AnnotationEntryGen> existingAnnotations = param_annotations[parameterIndex]; + final List<AnnotationEntryGen> existingAnnotations = param_annotations[parameterIndex]; if (existingAnnotations != null) { existingAnnotations.add(annotation); } else { - List<AnnotationEntryGen> l = new ArrayList<>(); + final List<AnnotationEntryGen> l = new ArrayList<>(); l.add(annotation); param_annotations[parameterIndex] = l; }
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/NameSignatureInstruction.java Tue Jun 21 20:50:19 2016 @@ -40,23 +40,23 @@ public abstract class NameSignatureInstr } public ConstantNameAndType getNameAndType(final ConstantPoolGen cpg) { - ConstantPool cp = cpg.getConstantPool(); - ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); + final ConstantPool cp = cpg.getConstantPool(); + final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); return (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex()); } /** @return signature of referenced method/field. */ public String getSignature(final ConstantPoolGen cpg) { - ConstantPool cp = cpg.getConstantPool(); - ConstantNameAndType cnat = getNameAndType(cpg); + final ConstantPool cp = cpg.getConstantPool(); + final ConstantNameAndType cnat = getNameAndType(cpg); return ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes(); } /** @return name of referenced method/field. */ public String getName(final ConstantPoolGen cpg) { - ConstantPool cp = cpg.getConstantPool(); - ConstantNameAndType cnat = getNameAndType(cpg); + final ConstantPool cp = cpg.getConstantPool(); + final ConstantNameAndType cnat = getNameAndType(cpg); return ((ConstantUtf8) cp.getConstant(cnat.getNameIndex())).getBytes(); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ObjectType.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ObjectType.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ObjectType.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ObjectType.java Tue Jun 21 20:50:19 2016 @@ -81,9 +81,9 @@ public class ObjectType extends Referenc @Deprecated public boolean referencesClass() { try { - JavaClass jc = Repository.lookupClass(class_name); + final JavaClass jc = Repository.lookupClass(class_name); return jc.isClass(); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { return false; } } @@ -99,9 +99,9 @@ public class ObjectType extends Referenc @Deprecated public boolean referencesInterface() { try { - JavaClass jc = Repository.lookupClass(class_name); + final JavaClass jc = Repository.lookupClass(class_name); return !jc.isClass(); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { return false; } } @@ -116,7 +116,7 @@ public class ObjectType extends Referenc * referenced by this type can't be found */ public boolean referencesClassExact() throws ClassNotFoundException { - JavaClass jc = Repository.lookupClass(class_name); + final JavaClass jc = Repository.lookupClass(class_name); return jc.isClass(); } @@ -130,7 +130,7 @@ public class ObjectType extends Referenc * referenced by this type can't be found */ public boolean referencesInterfaceExact() throws ClassNotFoundException { - JavaClass jc = Repository.lookupClass(class_name); + final JavaClass jc = Repository.lookupClass(class_name); return !jc.isClass(); } @@ -154,11 +154,11 @@ public class ObjectType extends Referenc * can't be found */ public boolean accessibleTo( final ObjectType accessor ) throws ClassNotFoundException { - JavaClass jc = Repository.lookupClass(class_name); + final JavaClass jc = Repository.lookupClass(class_name); if (jc.isPublic()) { return true; } - JavaClass acc = Repository.lookupClass(accessor.class_name); + final JavaClass acc = Repository.lookupClass(accessor.class_name); return acc.getPackageName().equals(jc.getPackageName()); } } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReferenceType.java Tue Jun 21 20:50:19 2016 @@ -73,7 +73,7 @@ public abstract class ReferenceType exte if (!(t instanceof ReferenceType)) { return false; } - ReferenceType T = (ReferenceType) t; + final ReferenceType T = (ReferenceType) t; if (this.equals(Type.NULL)) { return true; // This is not explicitely stated, but clear. Isn't it? } @@ -141,8 +141,8 @@ public abstract class ReferenceType exte if (T instanceof ArrayType) { /* TC and SC are the same primitive type (�2.4.1). */ - Type sc = ((ArrayType) this).getElementType(); - Type tc = ((ArrayType) T).getElementType(); + final Type sc = ((ArrayType) this).getElementType(); + final Type tc = ((ArrayType) T).getElementType(); if (sc instanceof BasicType && tc instanceof BasicType && sc.equals(tc)) { return true; } @@ -161,7 +161,7 @@ public abstract class ReferenceType exte // on one of them "interfaces implemented by arrays" is exchanged with "'Cloneable' or // 'java.io.Serializable'" if ((T instanceof ObjectType) && (((ObjectType) T).referencesInterfaceExact())) { - for (String element : Const.getInterfacesImplementedByArrays()) { + for (final String element : Const.getInterfacesImplementedByArrays()) { if (T.equals(ObjectType.getInstance(element))) { return true; } @@ -209,8 +209,8 @@ public abstract class ReferenceType exte } /* This code is from a bug report by Konstantin Shagin <ko...@cs.technion.ac.il> */ if ((this instanceof ArrayType) && (t instanceof ArrayType)) { - ArrayType arrType1 = (ArrayType) this; - ArrayType arrType2 = (ArrayType) t; + final ArrayType arrType1 = (ArrayType) this; + final ArrayType arrType2 = (ArrayType) t; if ((arrType1.getDimensions() == arrType2.getDimensions()) && arrType1.getBasicType() instanceof ObjectType && arrType2.getBasicType() instanceof ObjectType) { @@ -231,22 +231,22 @@ public abstract class ReferenceType exte // superinterfaces or even castability or assignment compatibility. } // this and t are ObjectTypes, see above. - ObjectType thiz = (ObjectType) this; - ObjectType other = (ObjectType) t; - JavaClass[] thiz_sups = Repository.getSuperClasses(thiz.getClassName()); - JavaClass[] other_sups = Repository.getSuperClasses(other.getClassName()); + final ObjectType thiz = (ObjectType) this; + final ObjectType other = (ObjectType) t; + final JavaClass[] thiz_sups = Repository.getSuperClasses(thiz.getClassName()); + final JavaClass[] other_sups = Repository.getSuperClasses(other.getClassName()); if ((thiz_sups == null) || (other_sups == null)) { return null; } // Waaahh... - JavaClass[] this_sups = new JavaClass[thiz_sups.length + 1]; - JavaClass[] t_sups = new JavaClass[other_sups.length + 1]; + final JavaClass[] this_sups = new JavaClass[thiz_sups.length + 1]; + final JavaClass[] t_sups = new JavaClass[other_sups.length + 1]; System.arraycopy(thiz_sups, 0, this_sups, 1, thiz_sups.length); System.arraycopy(other_sups, 0, t_sups, 1, other_sups.length); this_sups[0] = Repository.lookupClass(thiz.getClassName()); t_sups[0] = Repository.lookupClass(other.getClassName()); - for (JavaClass t_sup : t_sups) { - for (JavaClass this_sup : this_sups) { + for (final JavaClass t_sup : t_sups) { + for (final JavaClass this_sup : this_sups) { if (this_sup.equals(t_sup)) { return ObjectType.getInstance(this_sup.getClassName()); } @@ -303,22 +303,22 @@ public abstract class ReferenceType exte // superinterfaces or even castability or assignment compatibility. } // this and t are ObjectTypes, see above. - ObjectType thiz = (ObjectType) this; - ObjectType other = (ObjectType) t; - JavaClass[] thiz_sups = Repository.getSuperClasses(thiz.getClassName()); - JavaClass[] other_sups = Repository.getSuperClasses(other.getClassName()); + final ObjectType thiz = (ObjectType) this; + final ObjectType other = (ObjectType) t; + final JavaClass[] thiz_sups = Repository.getSuperClasses(thiz.getClassName()); + final JavaClass[] other_sups = Repository.getSuperClasses(other.getClassName()); if ((thiz_sups == null) || (other_sups == null)) { return null; } // Waaahh... - JavaClass[] this_sups = new JavaClass[thiz_sups.length + 1]; - JavaClass[] t_sups = new JavaClass[other_sups.length + 1]; + final JavaClass[] this_sups = new JavaClass[thiz_sups.length + 1]; + final JavaClass[] t_sups = new JavaClass[other_sups.length + 1]; System.arraycopy(thiz_sups, 0, this_sups, 1, thiz_sups.length); System.arraycopy(other_sups, 0, t_sups, 1, other_sups.length); this_sups[0] = Repository.lookupClass(thiz.getClassName()); t_sups[0] = Repository.lookupClass(other.getClassName()); - for (JavaClass t_sup : t_sups) { - for (JavaClass this_sup : this_sups) { + for (final JavaClass t_sup : t_sups) { + for (final JavaClass this_sup : this_sups) { if (this_sup.equals(t_sup)) { return ObjectType.getInstance(this_sup.getClassName()); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnaddressType.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnaddressType.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnaddressType.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/ReturnaddressType.java Tue Jun 21 20:50:19 2016 @@ -67,7 +67,7 @@ public class ReturnaddressType extends T if (!(rat instanceof ReturnaddressType)) { return false; } - ReturnaddressType that = (ReturnaddressType) rat; + final ReturnaddressType that = (ReturnaddressType) rat; if (this.returnTarget == null || that.returnTarget == null) { return that.returnTarget == this.returnTarget; } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SWITCH.java Tue Jun 21 20:50:19 2016 @@ -70,15 +70,15 @@ public final class SWITCH implements Com private void fillup( final int max_gap, final InstructionHandle target ) { - int max_size = match_length + match_length * max_gap; - int[] m_vec = new int[max_size]; - InstructionHandle[] t_vec = new InstructionHandle[max_size]; + final int max_size = match_length + match_length * max_gap; + final int[] m_vec = new int[max_size]; + final InstructionHandle[] t_vec = new InstructionHandle[max_size]; int count = 1; m_vec[0] = match[0]; t_vec[0] = targets[0]; for (int i = 1; i < match_length; i++) { - int prev = match[i - 1]; - int gap = match[i] - prev; + final int prev = match[i - 1]; + final int gap = match[i] - prev; for (int j = 1; j < gap; j++) { m_vec[count] = prev + j; t_vec[count] = target; @@ -102,7 +102,7 @@ public final class SWITCH implements Com int i = l; int j = r; int h; - int m = match[(l + r) / 2]; + final int m = match[(l + r) / 2]; InstructionHandle h2; do { while (match[i] < m) { Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Select.java Tue Jun 21 20:50:19 2016 @@ -95,7 +95,7 @@ public abstract class Select extends Bra this.targets = targets; // now it's safe to set default target setTarget(defaultTarget); - for (InstructionHandle target2 : targets) { + for (final InstructionHandle target2 : targets) { notifyTarget(null, target2, this); } if ((match_length = match.length) != targets.length) { @@ -122,7 +122,7 @@ public abstract class Select extends Bra @Override protected int updatePosition( final int offset, final int max_offset ) { setPosition(getPosition() + offset); // Additional offset caused by preceding SWITCHs, GOTOs, etc. - short old_length = (short) super.getLength(); + final short old_length = (short) super.getLength(); /* Alignment on 4-byte-boundary, + 1, because of tag byte. */ padding = (4 - ((getPosition() + 1) % 4)) % 4; @@ -165,7 +165,7 @@ public abstract class Select extends Bra */ @Override public String toString( final boolean verbose ) { - StringBuilder buf = new StringBuilder(super.toString(verbose)); + final StringBuilder buf = new StringBuilder(super.toString(verbose)); if (verbose) { for (int i = 0; i < match_length; i++) { String s = "null"; @@ -222,7 +222,7 @@ public abstract class Select extends Bra if (super.getTarget() == ih) { return true; } - for (InstructionHandle target2 : targets) { + for (final InstructionHandle target2 : targets) { if (target2 == ih) { return true; } @@ -233,7 +233,7 @@ public abstract class Select extends Bra @Override protected Object clone() throws CloneNotSupportedException { - Select copy = (Select) super.clone(); + final Select copy = (Select) super.clone(); copy.match = match.clone(); copy.indices = indices.clone(); copy.targets = targets.clone(); @@ -247,7 +247,7 @@ public abstract class Select extends Bra @Override void dispose() { super.dispose(); - for (InstructionHandle target2 : targets) { + for (final InstructionHandle target2 : targets) { target2.removeTargeter(this); } } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java Tue Jun 21 20:50:19 2016 @@ -188,7 +188,7 @@ public class SimpleElementValueGen exten throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } - ConstantUtf8 c = (ConstantUtf8) getConstantPool().getConstant(idx); + final ConstantUtf8 c = (ConstantUtf8) getConstantPool().getConstant(idx); return c.getBytes(); } @@ -198,7 +198,7 @@ public class SimpleElementValueGen exten throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } - ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); + final ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); return c.getBytes(); } @@ -209,34 +209,34 @@ public class SimpleElementValueGen exten switch (super.getElementValueType()) { case PRIMITIVE_INT: - ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); + final ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(c.getBytes()); case PRIMITIVE_LONG: - ConstantLong j = (ConstantLong) getConstantPool().getConstant(idx); + final ConstantLong j = (ConstantLong) getConstantPool().getConstant(idx); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: - ConstantDouble d = (ConstantDouble) getConstantPool().getConstant(idx); + final ConstantDouble d = (ConstantDouble) getConstantPool().getConstant(idx); return Double.toString(d.getBytes()); case PRIMITIVE_FLOAT: - ConstantFloat f = (ConstantFloat) getConstantPool().getConstant(idx); + final ConstantFloat f = (ConstantFloat) getConstantPool().getConstant(idx); return Float.toString(f.getBytes()); case PRIMITIVE_SHORT: - ConstantInteger s = (ConstantInteger) getConstantPool().getConstant(idx); + final ConstantInteger s = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(s.getBytes()); case PRIMITIVE_BYTE: - ConstantInteger b = (ConstantInteger) getConstantPool().getConstant(idx); + final ConstantInteger b = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(b.getBytes()); case PRIMITIVE_CHAR: - ConstantInteger ch = (ConstantInteger) getConstantPool().getConstant(idx); + final ConstantInteger ch = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(ch.getBytes()); case PRIMITIVE_BOOLEAN: - ConstantInteger bo = (ConstantInteger) getConstantPool().getConstant(idx); + final ConstantInteger bo = (ConstantInteger) getConstantPool().getConstant(idx); if (bo.getBytes() == 0) { return "false"; } return "true"; case STRING: - ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); + final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); return cu8.getBytes(); default: throw new RuntimeException( Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TABLESWITCH.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TABLESWITCH.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TABLESWITCH.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TABLESWITCH.java Tue Jun 21 20:50:19 2016 @@ -61,9 +61,9 @@ public class TABLESWITCH extends Select public void dump( final DataOutputStream out ) throws IOException { super.dump(out); final int _match_length = getMatch_length(); - int low = (_match_length > 0) ? super.getMatch(0) : 0; + final int low = (_match_length > 0) ? super.getMatch(0) : 0; out.writeInt(low); - int high = (_match_length > 0) ? super.getMatch(_match_length - 1) : 0; + final int high = (_match_length > 0) ? super.getMatch(_match_length - 1) : 0; out.writeInt(high); for (int i = 0; i < _match_length; i++) { out.writeInt(setIndices(i, getTargetOffset(super.getTarget(i)))); @@ -77,8 +77,8 @@ public class TABLESWITCH extends Select @Override protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException { super.initFromFile(bytes, wide); - int low = bytes.readInt(); - int high = bytes.readInt(); + final int low = bytes.readInt(); + final int high = bytes.readInt(); final int _match_length = high - low + 1; setMatch_length(_match_length); final short _fixed_length = (short) (13 + _match_length * 4); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java Tue Jun 21 20:50:19 2016 @@ -87,7 +87,7 @@ public abstract class Type { @Override public boolean equals(final Object o) { if (o instanceof Type) { - Type t = (Type)o; + final Type t = (Type)o; return (type == t.type) && signature.equals(t.signature); } return false; @@ -157,9 +157,9 @@ public abstract class Type { * @return method signature for given type(s). */ public static String getMethodSignature( final Type return_type, final Type[] arg_types ) { - StringBuilder buf = new StringBuilder("("); + final StringBuilder buf = new StringBuilder("("); if (arg_types != null) { - for (Type arg_type : arg_types) { + for (final Type arg_type : arg_types) { buf.append(arg_type.getSignature()); } } @@ -194,7 +194,7 @@ public abstract class Type { */ // @since 6.0 no longer final public static Type getType( final String signature ) throws StringIndexOutOfBoundsException { - byte type = Utility.typeOfSignature(signature); + final byte type = Utility.typeOfSignature(signature); if (type <= Const.T_VOID) { //corrected concurrent private static field acess wrap(consumed_chars, 1); @@ -205,16 +205,16 @@ public abstract class Type { dim++; } while (signature.charAt(dim) == '['); // Recurse, but just once, if the signature is ok - Type t = getType(signature.substring(dim)); + final Type t = getType(signature.substring(dim)); //corrected concurrent private static field acess // consumed_chars += dim; // update counter - is replaced by - int _temp = unwrap(consumed_chars) + dim; + final int _temp = unwrap(consumed_chars) + dim; wrap(consumed_chars, _temp); return new ArrayType(t, dim); } else { // type == T_REFERENCE // Utility.signatureToString understands how to parse // generic types. - String parsedSignature = Utility.signatureToString(signature, false); + final String parsedSignature = Utility.signatureToString(signature, false); wrap(consumed_chars, parsedSignature.length() + 2); // "Lblabla;" `L' and `;' are removed return ObjectType.getInstance(parsedSignature.replace('/', '.')); } @@ -230,9 +230,9 @@ public abstract class Type { public static Type getReturnType( final String signature ) { try { // Read return type after `)' - int index = signature.lastIndexOf(')') + 1; + final int index = signature.lastIndexOf(')') + 1; return getType(signature.substring(index)); - } catch (StringIndexOutOfBoundsException e) { // Should never occur + } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid method signature: " + signature, e); } } @@ -244,7 +244,7 @@ public abstract class Type { * @return array of argument types */ public static Type[] getArgumentTypes( final String signature ) { - List<Type> vec = new ArrayList<>(); + final List<Type> vec = new ArrayList<>(); int index; Type[] types; try { // Read all declarations between for `(' and `)' @@ -257,7 +257,7 @@ public abstract class Type { //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); } types = new Type[vec.size()]; @@ -315,7 +315,7 @@ public abstract class Type { * @return array of corresponding Type objects */ public static Type[] getTypes( final java.lang.Class<?>[] classes ) { - Type[] ret = new Type[classes.length]; + final Type[] ret = new Type[classes.length]; for (int i = 0; i < ret.length; i++) { ret[i] = getType(classes[i]); } @@ -324,9 +324,9 @@ public abstract class Type { public static String getSignature( final java.lang.reflect.Method meth ) { - StringBuilder sb = new StringBuilder("("); - Class<?>[] params = meth.getParameterTypes(); // avoid clone - for (Class<?> param : params) { + final StringBuilder sb = new StringBuilder("("); + final Class<?>[] params = meth.getParameterTypes(); // avoid clone + for (final Class<?> param : params) { sb.append(getType(param).getSignature()); } sb.append(")"); @@ -355,18 +355,18 @@ public abstract class Type { } index = 1; // current string position while (signature.charAt(index) != ')') { - int coded = getTypeSize(signature.substring(index)); + final int coded = getTypeSize(signature.substring(index)); res += size(coded); index += consumed(coded); } - } catch (StringIndexOutOfBoundsException e) { // Should never occur + } catch (final StringIndexOutOfBoundsException e) { // Should never occur throw new ClassFormatException("Invalid method signature: " + signature, e); } return res; } static int getTypeSize( final String signature ) throws StringIndexOutOfBoundsException { - byte type = Utility.typeOfSignature(signature); + final byte type = Utility.typeOfSignature(signature); if (type <= Const.T_VOID) { return encode(BasicType.getType(type).getSize(), 1); } else if (type == Const.T_ARRAY) { @@ -375,10 +375,10 @@ public abstract class Type { dim++; } while (signature.charAt(dim) == '['); // Recurse, but just once, if the signature is ok - int consumed = consumed(getTypeSize(signature.substring(dim))); + final int consumed = consumed(getTypeSize(signature.substring(dim))); return encode(1, dim + consumed); } else { // type == T_REFERENCE - int index = signature.indexOf(';'); // Look for closing `;' + final int index = signature.indexOf(';'); // Look for closing `;' if (index < 0) { throw new ClassFormatException("Invalid signature: " + signature); } @@ -388,7 +388,7 @@ public abstract class Type { static int getReturnTypeSize(final String signature) { - int index = signature.lastIndexOf(')') + 1; + final int index = signature.lastIndexOf(')') + 1; return Type.size(getTypeSize(signature.substring(index))); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/AttributeHTML.java Tue Jun 21 20:50:19 2016 @@ -81,7 +81,7 @@ final class AttributeHTML { final void writeAttribute( final Attribute attribute, final String anchor, final int method_number ) { - byte tag = attribute.getTag(); + final byte tag = attribute.getTag(); int index; if (tag == Const.ATTR_UNKNOWN) { return; @@ -98,19 +98,19 @@ final class AttributeHTML { */ switch (tag) { case Const.ATTR_CODE: - Code c = (Code) attribute; + final Code c = (Code) attribute; // Some directly printable values file.print("<UL><LI>Maximum stack size = " + c.getMaxStack() + "</LI>\n<LI>Number of local variables = " + c.getMaxLocals() + "</LI>\n<LI><A HREF=\"" + class_name + "_code.html#method" + method_number + "\" TARGET=Code>Byte code</A></LI></UL>\n"); // Get handled exceptions and list them - CodeException[] ce = c.getExceptionTable(); - int len = ce.length; + final CodeException[] ce = c.getExceptionTable(); + final int len = ce.length; if (len > 0) { file.print("<P><B>Exceptions handled</B><UL>"); - for (CodeException cex : ce) { - int catch_type = cex.getCatchType(); // Index in constant pool + for (final CodeException cex : ce) { + final int catch_type = cex.getCatchType(); // Index in constant pool file.print("<LI>"); if (catch_type != 0) { file.print(constant_html.referenceConstant(catch_type)); // Create Link to _cp.html @@ -140,9 +140,9 @@ final class AttributeHTML { break; case Const.ATTR_EXCEPTIONS: // List thrown exceptions - int[] indices = ((ExceptionTable) attribute).getExceptionIndexTable(); + final int[] indices = ((ExceptionTable) attribute).getExceptionIndexTable(); file.print("<UL>"); - for (int indice : indices) { + for (final int indice : indices) { file.print("<LI><A HREF=\"" + class_name + "_cp.html#cp" + indice + "\" TARGET=\"ConstantPool\">Exception class index(" + indice + ")</A>\n"); @@ -150,7 +150,7 @@ final class AttributeHTML { file.print("</UL>\n"); break; case Const.ATTR_LINE_NUMBER_TABLE: - LineNumber[] line_numbers = ((LineNumberTable) attribute).getLineNumberTable(); + final LineNumber[] line_numbers = ((LineNumberTable) attribute).getLineNumberTable(); // List line number pairs file.print("<P>"); for (int i = 0; i < line_numbers.length; i++) { @@ -162,16 +162,16 @@ final class AttributeHTML { } break; case Const.ATTR_LOCAL_VARIABLE_TABLE: - LocalVariable[] vars = ((LocalVariableTable) attribute).getLocalVariableTable(); + final LocalVariable[] vars = ((LocalVariableTable) attribute).getLocalVariableTable(); // List name, range and type file.print("<UL>"); - for (LocalVariable var : vars) { + for (final LocalVariable var : vars) { index = var.getSignatureIndex(); String signature = ((ConstantUtf8) constant_pool.getConstant(index, Const.CONSTANT_Utf8)).getBytes(); signature = Utility.signatureToString(signature, false); - int start = var.getStartPC(); - int end = start + var.getLength(); + final int start = var.getStartPC(); + final int end = start + var.getLength(); file.println("<LI>" + Class2HTML.referenceType(signature) + " <B>" + var.getName() + "</B> in slot %" + var.getIndex() + "<BR>Valid from lines " + "<A HREF=\"" + class_name @@ -182,10 +182,10 @@ final class AttributeHTML { file.print("</UL>\n"); break; case Const.ATTR_INNER_CLASSES: - InnerClass[] classes = ((InnerClasses) attribute).getInnerClasses(); + final InnerClass[] classes = ((InnerClasses) attribute).getInnerClasses(); // List inner classes file.print("<UL>"); - for (InnerClass classe : classes) { + for (final InnerClass classe : classes) { String name; String access; index = classe.getInnerNameIndex(); Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELFactory.java Tue Jun 21 20:50:19 2016 @@ -84,7 +84,7 @@ class BCELFactory extends EmptyVisitor { if (!_mg.isAbstract() && !_mg.isNative()) { for (InstructionHandle ih = _mg.getInstructionList().getStart(); ih != null; ih = ih .getNext()) { - Instruction i = ih.getInstruction(); + final Instruction i = ih.getInstruction(); if (i instanceof BranchInstruction) { branch_map.put(i, ih); // memorize container } @@ -108,7 +108,7 @@ class BCELFactory extends EmptyVisitor { private boolean visitInstruction( final Instruction i ) { - short opcode = i.getOpcode(); + final short opcode = i.getOpcode(); if ((InstructionConst.getInstruction(opcode) != null) && !(i instanceof ConstantPushInstruction) && !(i instanceof ReturnInstruction)) { // Handled below _out.println("il.append(InstructionConst." @@ -121,13 +121,13 @@ class BCELFactory extends EmptyVisitor { @Override public void visitLocalVariableInstruction( final LocalVariableInstruction i ) { - short opcode = i.getOpcode(); - Type type = i.getType(_cp); + final short opcode = i.getOpcode(); + final Type type = i.getType(_cp); if (opcode == Const.IINC) { _out.println("il.append(new IINC(" + i.getIndex() + ", " + ((IINC) i).getIncrement() + "));"); } else { - String kind = (opcode < Const.ISTORE) ? "Load" : "Store"; + final String kind = (opcode < Const.ISTORE) ? "Load" : "Store"; _out.println("il.append(_factory.create" + kind + "(" + BCELifier.printType(type) + ", " + i.getIndex() + "));"); } @@ -136,9 +136,9 @@ class BCELFactory extends EmptyVisitor { @Override public void visitArrayInstruction( final ArrayInstruction i ) { - short opcode = i.getOpcode(); - Type type = i.getType(_cp); - String kind = (opcode < Const.IASTORE) ? "Load" : "Store"; + final short opcode = i.getOpcode(); + final Type type = i.getType(_cp); + final String kind = (opcode < Const.IASTORE) ? "Load" : "Store"; _out.println("il.append(_factory.createArray" + kind + "(" + BCELifier.printType(type) + "));"); } @@ -146,10 +146,10 @@ class BCELFactory extends EmptyVisitor { @Override public void visitFieldInstruction( final FieldInstruction i ) { - short opcode = i.getOpcode(); - String class_name = i.getClassName(_cp); - String field_name = i.getFieldName(_cp); - Type type = i.getFieldType(_cp); + final short opcode = i.getOpcode(); + final String class_name = i.getClassName(_cp); + final String field_name = i.getFieldName(_cp); + final Type type = i.getFieldType(_cp); _out.println("il.append(_factory.createFieldAccess(\"" + class_name + "\", \"" + field_name + "\", " + BCELifier.printType(type) + ", " + CONSTANT_PREFIX + Const.getOpcodeName(opcode).toUpperCase(Locale.ENGLISH) + "));"); @@ -158,11 +158,11 @@ class BCELFactory extends EmptyVisitor { @Override public void visitInvokeInstruction( final InvokeInstruction i ) { - short opcode = i.getOpcode(); - String class_name = i.getClassName(_cp); - String method_name = i.getMethodName(_cp); - Type type = i.getReturnType(_cp); - Type[] arg_types = i.getArgumentTypes(_cp); + final short opcode = i.getOpcode(); + final String class_name = i.getClassName(_cp); + final String method_name = i.getMethodName(_cp); + final Type type = i.getReturnType(_cp); + final Type[] arg_types = i.getArgumentTypes(_cp); _out.println("il.append(_factory.createInvoke(\"" + class_name + "\", \"" + method_name + "\", " + BCELifier.printType(type) + ", " + BCELifier.printArgumentTypes(arg_types) + ", " + CONSTANT_PREFIX @@ -178,7 +178,7 @@ class BCELFactory extends EmptyVisitor { } else { type = ((NEWARRAY) i).getType(); } - short opcode = ((Instruction) i).getOpcode(); + final short opcode = ((Instruction) i).getOpcode(); int dim = 1; switch (opcode) { case Const.NEW: @@ -213,7 +213,7 @@ class BCELFactory extends EmptyVisitor { } else if (value instanceof Long) { embed += "L"; } else if (value instanceof ObjectType) { - ObjectType ot = (ObjectType) value; + final ObjectType ot = (ObjectType) value; embed = "new ObjectType(\""+ot.getClassName()+"\")"; } @@ -241,21 +241,21 @@ class BCELFactory extends EmptyVisitor { @Override public void visitINSTANCEOF( final INSTANCEOF i ) { - Type type = i.getType(_cp); + final Type type = i.getType(_cp); _out.println("il.append(new INSTANCEOF(_cp.addClass(" + BCELifier.printType(type) + ")));"); } @Override public void visitCHECKCAST( final CHECKCAST i ) { - Type type = i.getType(_cp); + final Type type = i.getType(_cp); _out.println("il.append(_factory.createCheckCast(" + BCELifier.printType(type) + "));"); } @Override public void visitReturnInstruction( final ReturnInstruction i ) { - Type type = i.getType(_cp); + final Type type = i.getType(_cp); _out.println("il.append(_factory.createReturn(" + BCELifier.printType(type) + "));"); } @@ -265,14 +265,14 @@ class BCELFactory extends EmptyVisitor { @Override public void visitBranchInstruction( final BranchInstruction bi ) { - BranchHandle bh = (BranchHandle) branch_map.get(bi); - int pos = bh.getPosition(); - String name = bi.getName() + "_" + pos; + final BranchHandle bh = (BranchHandle) branch_map.get(bi); + final int pos = bh.getPosition(); + final String name = bi.getName() + "_" + pos; if (bi instanceof Select) { - Select s = (Select) bi; + final Select s = (Select) bi; branches.add(bi); - StringBuilder args = new StringBuilder("new int[] { "); - int[] matchs = s.getMatchs(); + final StringBuilder args = new StringBuilder("new int[] { "); + final int[] matchs = s.getMatchs(); for (int i = 0; i < matchs.length; i++) { args.append(matchs[i]); if (i < matchs.length - 1) { @@ -290,7 +290,7 @@ class BCELFactory extends EmptyVisitor { } _out.println(" }, null);"); } else { - int t_pos = bh.getTarget().getPosition(); + final int t_pos = bh.getTarget().getPosition(); String target; if (pos > t_pos) { target = "ih_" + t_pos; @@ -317,14 +317,14 @@ class BCELFactory extends EmptyVisitor { private void updateBranchTargets() { - for (BranchInstruction bi : branches) { - BranchHandle bh = (BranchHandle) branch_map.get(bi); - int pos = bh.getPosition(); - String name = bi.getName() + "_" + pos; + for (final BranchInstruction bi : branches) { + final BranchHandle bh = (BranchHandle) branch_map.get(bi); + final int pos = bh.getPosition(); + final String name = bi.getName() + "_" + pos; int t_pos = bh.getTarget().getPosition(); _out.println(" " + name + ".setTarget(ih_" + t_pos + ");"); if (bi instanceof Select) { - InstructionHandle[] ihs = ((Select) bi).getTargets(); + final InstructionHandle[] ihs = ((Select) bi).getTargets(); for (int j = 0; j < ihs.length; j++) { t_pos = ihs[j].getPosition(); _out.println(" " + name + ".setTarget(" + j + ", ih_" + t_pos + ");"); @@ -335,9 +335,9 @@ class BCELFactory extends EmptyVisitor { private void updateExceptionHandlers() { - CodeExceptionGen[] handlers = _mg.getExceptionHandlers(); - for (CodeExceptionGen h : handlers) { - String type = (h.getCatchType() == null) ? "null" : BCELifier.printType(h + final CodeExceptionGen[] handlers = _mg.getExceptionHandlers(); + for (final CodeExceptionGen h : handlers) { + final String type = (h.getCatchType() == null) ? "null" : BCELifier.printType(h .getCatchType()); _out.println(" method.addExceptionHandler(" + "ih_" + h.getStartPC().getPosition() + ", " + "ih_" + h.getEndPC().getPosition() + ", " + "ih_" Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/BCELifier.java Tue Jun 21 20:50:19 2016 @@ -85,9 +85,9 @@ public class BCELifier extends org.apach @Override public void visitJavaClass( final JavaClass clazz ) { String class_name = clazz.getClassName(); - String super_name = clazz.getSuperclassName(); - String package_name = clazz.getPackageName(); - String inter = Utility.printArray(clazz.getInterfaceNames(), false, true); + final String super_name = clazz.getSuperclassName(); + final String package_name = clazz.getPackageName(); + final String inter = Utility.printArray(clazz.getInterfaceNames(), false, true); if (!"".equals(package_name)) { class_name = class_name.substring(package_name.length() + 1); _out.println("package " + package_name + ";"); @@ -115,17 +115,17 @@ public class BCELifier extends org.apach _out.println(" }"); _out.println(); printCreate(); - Field[] fields = clazz.getFields(); + final Field[] fields = clazz.getFields(); if (fields.length > 0) { _out.println(" private void createFields() {"); _out.println(" FieldGen field;"); - for (Field field : fields) { + for (final Field field : fields) { field.accept(this); } _out.println(" }"); _out.println(); } - Method[] methods = clazz.getMethods(); + final Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { _out.println(" private void createMethod_" + i + "() {"); methods[i].accept(this); @@ -139,11 +139,11 @@ public class BCELifier extends org.apach private void printCreate() { _out.println(" public void create(OutputStream out) throws IOException {"); - Field[] fields = _clazz.getFields(); + final Field[] fields = _clazz.getFields(); if (fields.length > 0) { _out.println(" createFields();"); } - Method[] methods = _clazz.getMethods(); + final Method[] methods = _clazz.getMethods(); for (int i = 0; i < methods.length; i++) { _out.println(" createMethod_" + i + "();"); } @@ -154,7 +154,7 @@ public class BCELifier extends org.apach private void printMain() { - String class_name = _clazz.getClassName(); + final String class_name = _clazz.getClassName(); _out.println(" public static void main(String[] args) throws Exception {"); _out.println(" " + class_name + "Creator creator = new " + class_name + "Creator();"); _out.println(" creator.create(new FileOutputStream(\"" + class_name + ".class\"));"); @@ -167,9 +167,9 @@ public class BCELifier extends org.apach _out.println(); _out.println(" field = new FieldGen(" + printFlags(field.getAccessFlags()) + ", " + printType(field.getSignature()) + ", \"" + field.getName() + "\", _cp);"); - ConstantValue cv = field.getConstantValue(); + final ConstantValue cv = field.getConstantValue(); if (cv != null) { - String value = cv.toString(); + final String value = cv.toString(); _out.println(" field.setInitValue(" + value + ")"); } _out.println(" _cg.addField(field.getField());"); @@ -178,7 +178,7 @@ public class BCELifier extends org.apach @Override public void visitMethod( final Method method ) { - MethodGen mg = new MethodGen(method, _clazz.getClassName(), _cp); + final MethodGen mg = new MethodGen(method, _clazz.getClassName(), _cp); _out.println(" InstructionList il = new InstructionList();"); _out.println(" MethodGen method = new MethodGen(" + printFlags(method.getAccessFlags(), FLAGS.METHOD) + ", " @@ -187,7 +187,7 @@ public class BCELifier extends org.apach + "new String[] { " + Utility.printArray(mg.getArgumentNames(), false, true) + " }, \"" + method.getName() + "\", \"" + _clazz.getClassName() + "\", il, _cp);"); _out.println(); - BCELFactory factory = new BCELFactory(mg, _out); + final BCELFactory factory = new BCELFactory(mg, _out); factory.start(); _out.println(" method.setMaxStack();"); _out.println(" method.setMaxLocals();"); @@ -211,7 +211,7 @@ public class BCELifier extends org.apach if (flags == 0) { return "0"; } - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0, pow = 1; pow <= Const.MAX_ACC_FLAG; i++) { if ((flags & pow) != 0) { if ((pow == Const.ACC_SYNCHRONIZED) && (location == FLAGS.CLASS)) { @@ -230,7 +230,7 @@ public class BCELifier extends org.apach } pow <<= 1; } - String str = buf.toString(); + final String str = buf.toString(); return str.substring(0, str.length() - 3); } @@ -239,7 +239,7 @@ public class BCELifier extends org.apach if (arg_types.length == 0) { return "Type.NO_ARGS"; } - StringBuilder args = new StringBuilder(); + final StringBuilder args = new StringBuilder(); for (int i = 0; i < arg_types.length; i++) { args.append(printType(arg_types[i])); if (i < arg_types.length - 1) { @@ -256,8 +256,8 @@ public class BCELifier extends org.apach static String printType( final String signature ) { - Type type = Type.getType(signature); - byte t = type.getType(); + final Type type = Type.getType(signature); + final byte t = type.getType(); if (t <= Const.T_VOID) { return "Type." + Const.getTypeName(t).toUpperCase(Locale.ENGLISH); } else if (type.toString().equals("java.lang.String")) { @@ -267,7 +267,7 @@ public class BCELifier extends org.apach } else if (type.toString().equals("java.lang.StringBuffer")) { return "Type.STRINGBUFFER"; } else if (type instanceof ArrayType) { - ArrayType at = (ArrayType) type; + final ArrayType at = (ArrayType) type; return "new ArrayType(" + printType(at.getBasicType()) + ", " + at.getDimensions() + ")"; } else { @@ -284,8 +284,8 @@ public class BCELifier extends org.apach System.out.println("\tThe class must exist on the classpath"); return; } - JavaClass java_class = getJavaClass(argv[0]); - BCELifier bcelifier = new BCELifier(java_class, System.out); + final JavaClass java_class = getJavaClass(argv[0]); + final BCELifier bcelifier = new BCELifier(java_class, System.out); bcelifier.start(); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/Class2HTML.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/Class2HTML.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/Class2HTML.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/Class2HTML.java Tue Jun 21 20:50:19 2016 @@ -82,24 +82,24 @@ public class Class2HTML implements Const * @param dir The directory to put the files in */ public Class2HTML(final JavaClass java_class, final String dir) throws IOException { - Method[] methods = java_class.getMethods(); + final Method[] methods = java_class.getMethods(); this.java_class = java_class; this.dir = dir; class_name = java_class.getClassName(); // Remember full name constant_pool = java_class.getConstantPool(); // Get package name by tacking off everything after the last `.' - int index = class_name.lastIndexOf('.'); + final int index = class_name.lastIndexOf('.'); if (index > -1) { class_package = class_name.substring(0, index); } else { class_package = ""; // default package } - ConstantHTML constant_html = new ConstantHTML(dir, class_name, class_package, methods, + final ConstantHTML constant_html = new ConstantHTML(dir, class_name, class_package, methods, constant_pool); /* Attributes can't be written in one step, so we just open a file * which will be written consequently. */ - AttributeHTML attribute_html = new AttributeHTML(dir, class_name, constant_pool, + final AttributeHTML attribute_html = new AttributeHTML(dir, class_name, constant_pool, constant_html); new MethodHTML(dir, class_name, methods, java_class.getFields(), constant_html, attribute_html); @@ -111,12 +111,12 @@ public class Class2HTML implements Const public static void main( final String[] argv ) throws IOException { - String[] file_name = new String[argv.length]; + final String[] file_name = new String[argv.length]; int files = 0; ClassParser parser = null; JavaClass java_class = null; String zip_file = null; - char sep = File.separatorChar; + final char sep = File.separatorChar; String dir = "." + sep; // Where to store HTML files /* Parse command line arguments. */ @@ -129,7 +129,7 @@ public class Class2HTML implements Const } final File store = new File(dir); if (!store.isDirectory()) { - boolean created = store.mkdirs(); // Create target directory if necessary + final boolean created = store.mkdirs(); // Create target directory if necessary if (!created) { if (!store.isDirectory()) { System.out.println("Tried to create the directory " + dir + " but failed"); @@ -179,7 +179,7 @@ public class Class2HTML implements Const static String referenceType( final String type ) { String short_type = Utility.compactClassName(type); short_type = Utility.compactClassName(short_type, class_package + ".", true); - int index = type.indexOf('['); // Type is an array? + final int index = type.indexOf('['); // Type is an array? String base_type = type; if (index > -1) { base_type = type.substring(0, index); // Tack of the `[' @@ -193,7 +193,7 @@ public class Class2HTML implements Const static String toHTML( final String str ) { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < str.length(); i++) { char ch; switch (ch = str.charAt(i)) { @@ -230,7 +230,7 @@ public class Class2HTML implements Const + "<FRAME NAME=\"Methods\" SRC=\"" + class_name + "_methods.html\"\n MARGINWIDTH=0 " + "MARGINHEIGHT=0 FRAMEBORDER=1 SCROLLING=\"AUTO\">\n" + "</FRAMESET></FRAMESET></HTML>"); } - Attribute[] attributes = java_class.getAttributes(); + final Attribute[] attributes = java_class.getAttributes(); for (int i = 0; i < attributes.length; i++) { attribute_html.writeAttribute(attributes[i], "class" + i); } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoader.java Tue Jun 21 20:50:19 2016 @@ -111,7 +111,7 @@ public class ClassLoader extends java.la /* Second try: Load system class using system class loader. You better * don't mess around with them. */ - for (String ignored_package : ignored_packages) { + for (final String ignored_package : ignored_packages) { if (class_name.startsWith(ignored_package)) { cl = getParent().loadClass(class_name); break; @@ -131,7 +131,7 @@ public class ClassLoader extends java.la } } if (clazz != null) { - byte[] bytes = clazz.getBytes(); + final byte[] bytes = clazz.getBytes(); cl = defineClass(class_name, bytes, 0, bytes.length); } else { cl = Class.forName(class_name); @@ -169,22 +169,22 @@ public class ClassLoader extends java.la * @param class_name compressed byte code with "$$BCEL$$" in it */ protected JavaClass createClass( final String class_name ) { - int index = class_name.indexOf(BCEL_TOKEN); - String real_name = class_name.substring(index + BCEL_TOKEN.length()); + final int index = class_name.indexOf(BCEL_TOKEN); + final String real_name = class_name.substring(index + BCEL_TOKEN.length()); JavaClass clazz = null; try { - byte[] bytes = Utility.decode(real_name, true); - ClassParser parser = new ClassParser(new ByteArrayInputStream(bytes), "foo"); + final byte[] bytes = Utility.decode(real_name, true); + final ClassParser parser = new ClassParser(new ByteArrayInputStream(bytes), "foo"); clazz = parser.parse(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); return null; } // Adapt the class name to the passed value - ConstantPool cp = clazz.getConstantPool(); - ConstantClass cl = (ConstantClass) cp.getConstant(clazz.getClassNameIndex(), + final ConstantPool cp = clazz.getConstantPool(); + final ConstantClass cl = (ConstantClass) cp.getConstant(clazz.getClassNameIndex(), Constants.CONSTANT_Class); - ConstantUtf8 name = (ConstantUtf8) cp.getConstant(cl.getNameIndex(), + final ConstantUtf8 name = (ConstantUtf8) cp.getConstant(cl.getNameIndex(), Constants.CONSTANT_Utf8); name.setBytes(class_name.replace('.', '/')); return clazz; Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java?rev=1749603&r1=1749602&r2=1749603&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java Tue Jun 21 20:50:19 2016 @@ -80,7 +80,7 @@ public class ClassLoaderRepository imple */ @Override public JavaClass loadClass(final String className) throws ClassNotFoundException { - String classFile = className.replace('.', '/'); + final String classFile = className.replace('.', '/'); JavaClass RC = findClass(className); if (RC != null) { return RC; @@ -89,11 +89,11 @@ public class ClassLoaderRepository imple if (is == null) { throw new ClassNotFoundException(className + " not found."); } - ClassParser parser = new ClassParser(is, className); + final ClassParser parser = new ClassParser(is, className); RC = parser.parse(); storeClass(RC); return RC; - } catch (IOException e) { + } catch (final IOException e) { throw new ClassNotFoundException(className + " not found: " + e, e); } }