diff --git a/asm-commons/src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java b/asm-commons/src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java index e47860da619c0c4b0c57e56e9eddf4f20900f38c..2901a8420912187764dcbfc843028133fd9d070e 100644 --- a/asm-commons/src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java +++ b/asm-commons/src/main/java/org/objectweb/asm/commons/TryCatchBlockSorter.java @@ -51,13 +51,13 @@ import org.objectweb.asm.tree.TryCatchBlockNode; public class TryCatchBlockSorter extends MethodNode { public TryCatchBlockSorter( - final MethodVisitor mv, + final MethodVisitor methodVisitor, final int access, final String name, - final String desc, + final String descriptor, final String signature, final String[] exceptions) { - this(Opcodes.ASM6, mv, access, name, desc, signature, exceptions); + this(Opcodes.ASM6, methodVisitor, access, name, descriptor, signature, exceptions); if (getClass() != TryCatchBlockSorter.class) { throw new IllegalStateException(); } @@ -65,36 +65,36 @@ public class TryCatchBlockSorter extends MethodNode { protected TryCatchBlockSorter( final int api, - final MethodVisitor mv, + final MethodVisitor methodVisitor, final int access, final String name, - final String desc, + final String descriptor, final String signature, final String[] exceptions) { - super(api, access, name, desc, signature, exceptions); - this.mv = mv; + super(api, access, name, descriptor, signature, exceptions); + this.mv = methodVisitor; } @Override public void visitEnd() { - // Compares TryCatchBlockNodes by the length of their "try" block. - Comparator comp = + // Sort the TryCatchBlockNode elements by the length of their "try" block. + Collections.sort( + tryCatchBlocks, new Comparator() { - public int compare(TryCatchBlockNode t1, TryCatchBlockNode t2) { - int len1 = blockLength(t1); - int len2 = blockLength(t2); - return len1 - len2; + public int compare( + final TryCatchBlockNode tryCatchBlockNode1, + final TryCatchBlockNode tryCatchBlockNode2) { + return blockLength(tryCatchBlockNode1) - blockLength(tryCatchBlockNode2); } - private int blockLength(TryCatchBlockNode block) { - int startidx = instructions.indexOf(block.start); - int endidx = instructions.indexOf(block.end); - return endidx - startidx; + private int blockLength(final TryCatchBlockNode tryCatchBlockNode) { + int startIndex = instructions.indexOf(tryCatchBlockNode.start); + int endIndex = instructions.indexOf(tryCatchBlockNode.end); + return endIndex - startIndex; } - }; - Collections.sort(tryCatchBlocks, comp); - // Updates the 'target' of each try catch block annotation. + }); + // Update the 'target' of each try catch block annotation. for (int i = 0; i < tryCatchBlocks.size(); ++i) { tryCatchBlocks.get(i).updateIndex(i); }