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
commit 5b76c595aa95e4b3a0defbc68abf1b48dca52400 Author: Gary David Gregory (Code signing key) <ggreg...@apache.org> AuthorDate: Sat Oct 15 17:27:05 2022 -0400 Inline single use local variables Format tweaks --- .../java/org/apache/bcel/classfile/ConstantPoolTestCase.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java b/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java index 5e479983..871a3277 100644 --- a/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java +++ b/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java @@ -24,7 +24,6 @@ import org.apache.bcel.AbstractTestCase; import org.apache.bcel.Const; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionHandle; -import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.MethodGen; import org.junit.jupiter.api.Test; @@ -32,22 +31,18 @@ public class ConstantPoolTestCase extends AbstractTestCase { private InstructionHandle[] getInstructionHandles(final JavaClass clazz, final ConstantPoolGen cp, final Method method) { final MethodGen methodGen = new MethodGen(method, clazz.getClassName(), cp); - final InstructionList instructionList = methodGen.getInstructionList(); - return instructionList.getInstructionHandles(); + return methodGen.getInstructionList().getInstructionHandles(); } @Test public void testConstantToString() throws ClassNotFoundException { final JavaClass clazz = getTestClass(PACKAGE_BASE_NAME + ".data.SimpleClassWithDefaultConstructor"); final ConstantPoolGen cp = new ConstantPoolGen(clazz.getConstantPool()); - final Method[] methods = clazz.getMethods(); - for (final Method method : methods) { if (method.getName().equals("<init>")) { for (final InstructionHandle instructionHandle : getInstructionHandles(clazz, cp, method)) { - final String string = instructionHandle.getInstruction().toString(cp.getConstantPool()); - assertNotNull(string); + assertNotNull(instructionHandle.getInstruction().toString(cp.getConstantPool())); // TODO Need real assertions. // System.out.println(string); } @@ -59,7 +54,6 @@ public class ConstantPoolTestCase extends AbstractTestCase { public void testTooManyConstants() throws ClassNotFoundException { final JavaClass clazz = getTestClass(PACKAGE_BASE_NAME + ".data.SimpleClassWithDefaultConstructor"); final ConstantPoolGen cp = new ConstantPoolGen(clazz.getConstantPool()); - int i = cp.getSize(); while (i < Const.MAX_CP_ENTRIES - 1) { cp.addLong(i);