This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/master by this push: new 6ed89aa * Remove duplicate condition 'cl == Byte.TYPE' (#94) 6ed89aa is described below commit 6ed89aa5274e53ce3a2958079068934aae9ce424 Author: Arturo Bernal <arturobern...@gmail.com> AuthorDate: Wed Jul 21 15:51:25 2021 +0200 * Remove duplicate condition 'cl == Byte.TYPE' (#94) * Inline variable --- src/main/java/org/apache/bcel/classfile/EnclosingMethod.java | 8 ++------ src/main/java/org/apache/bcel/classfile/Utility.java | 3 +-- src/main/java/org/apache/bcel/generic/MethodGen.java | 3 +-- src/main/java/org/apache/bcel/generic/Type.java | 3 --- src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java | 5 ++--- .../org/apache/bcel/verifier/structurals/ControlFlowGraph.java | 3 +-- src/main/java/org/apache/bcel/verifier/structurals/Frame.java | 3 +-- .../java/org/apache/bcel/verifier/structurals/OperandStack.java | 3 +-- 8 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/apache/bcel/classfile/EnclosingMethod.java b/src/main/java/org/apache/bcel/classfile/EnclosingMethod.java index 54bbb6b..d188526 100644 --- a/src/main/java/org/apache/bcel/classfile/EnclosingMethod.java +++ b/src/main/java/org/apache/bcel/classfile/EnclosingMethod.java @@ -83,18 +83,14 @@ public class EnclosingMethod extends Attribute { } public final ConstantClass getEnclosingClass() { - final ConstantClass c = - (ConstantClass)super.getConstantPool().getConstant(classIndex,Const.CONSTANT_Class); - return c; + return (ConstantClass)super.getConstantPool().getConstant(classIndex,Const.CONSTANT_Class); } public final ConstantNameAndType getEnclosingMethod() { if (methodIndex == 0) { return null; } - final ConstantNameAndType nat = - (ConstantNameAndType)super.getConstantPool().getConstant(methodIndex,Const.CONSTANT_NameAndType); - return nat; + return (ConstantNameAndType)super.getConstantPool().getConstant(methodIndex,Const.CONSTANT_NameAndType); } @Override diff --git a/src/main/java/org/apache/bcel/classfile/Utility.java b/src/main/java/org/apache/bcel/classfile/Utility.java index ea25b8e..7ac5cd7 100644 --- a/src/main/java/org/apache/bcel/classfile/Utility.java +++ b/src/main/java/org/apache/bcel/classfile/Utility.java @@ -1549,8 +1549,7 @@ public abstract class Utility { final char[] tmp = { (char) i, (char) j }; - final int s = Integer.parseInt(new String(tmp), 16); - return s; + return Integer.parseInt(new String(tmp), 16); } return MAP_CHAR[i]; } diff --git a/src/main/java/org/apache/bcel/generic/MethodGen.java b/src/main/java/org/apache/bcel/generic/MethodGen.java index 4aa5824..e402b85 100644 --- a/src/main/java/org/apache/bcel/generic/MethodGen.java +++ b/src/main/java/org/apache/bcel/generic/MethodGen.java @@ -994,8 +994,7 @@ public class MethodGen extends FieldGenOrMethodGen { public BranchTarget pop() { if (!branchTargets.empty()) { - final BranchTarget bt = branchTargets.pop(); - return bt; + return branchTargets.pop(); } return null; } diff --git a/src/main/java/org/apache/bcel/generic/Type.java b/src/main/java/org/apache/bcel/generic/Type.java index 57df98a..15161b2 100644 --- a/src/main/java/org/apache/bcel/generic/Type.java +++ b/src/main/java/org/apache/bcel/generic/Type.java @@ -299,9 +299,6 @@ public abstract class Type { if (cl == Short.TYPE) { return SHORT; } - if (cl == Byte.TYPE) { - return BYTE; - } if (cl == Long.TYPE) { return LONG; } diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java index ddbc54a..25982a6 100644 --- a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java +++ b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java @@ -1072,7 +1072,6 @@ public final class Pass2Verifier extends PassVerifier implements Constants { "' is not correctly named 'LocalVariableTable' but '"+lvtname+"'."); } - final Code code = obj; //In JustIce, the check for correct offsets into the code array is delayed to Pass 3a. final LocalVariable[] localvariables = lvt.getLocalVariableTable(); @@ -1097,11 +1096,11 @@ public final class Pass2Verifier extends PassVerifier implements Constants { "' used by LocalVariable '"+tostring(localvariable)+"' referenced by '"+tostring(lvt)+"'.", cfe); } final int localindex = localvariable.getIndex(); - if ( ( t==Type.LONG || t==Type.DOUBLE? localindex+1:localindex) >= code.getMaxLocals()) { + if ( ( t==Type.LONG || t==Type.DOUBLE? localindex+1:localindex) >= obj.getMaxLocals()) { throw new ClassConstraintException("LocalVariableTable attribute '"+tostring(lvt)+ "' references a LocalVariable '"+tostring(localvariable)+ "' with an index that exceeds the surrounding Code attribute's max_locals value of '"+ - code.getMaxLocals()+"'."); + obj.getMaxLocals()+"'."); } try{ diff --git a/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java b/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java index 7cc286f..749f537 100644 --- a/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java +++ b/src/main/java/org/apache/bcel/verifier/structurals/ControlFlowGraph.java @@ -222,8 +222,7 @@ public class ControlFlowGraph{ //TODO: Put information in the brackets, e.g. // Is this an ExceptionHandler? Is this a RET? Is this the start of // a subroutine? - final String ret = getInstruction().toString(false)+"\t[InstructionContext]"; - return ret; + return getInstruction().toString(false)+"\t[InstructionContext]"; } /** diff --git a/src/main/java/org/apache/bcel/verifier/structurals/Frame.java b/src/main/java/org/apache/bcel/verifier/structurals/Frame.java index e1845f5..34e9945 100644 --- a/src/main/java/org/apache/bcel/verifier/structurals/Frame.java +++ b/src/main/java/org/apache/bcel/verifier/structurals/Frame.java @@ -69,8 +69,7 @@ public class Frame{ */ @Override protected Object clone() { - final Frame f = new Frame(locals.getClone(), stack.getClone()); - return f; + return new Frame(locals.getClone(), stack.getClone()); } /** diff --git a/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java b/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java index e2e8cf8..ef20e35 100644 --- a/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java +++ b/src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java @@ -137,8 +137,7 @@ public class OperandStack implements Cloneable { * Returns the element on top of the stack. The element is popped off the stack. */ public Type pop() { - final Type e = stack.remove(size()-1); - return e; + return stack.remove(size()-1); } /**