You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/01/06 20:37:35 UTC

(commons-bcel) branch master updated (da483058 -> f3bcd0a7)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


    from da483058 Remove trailing whitespace
     new f20946d0 Use current version of Mockito 4.
     new f3bcd0a7 Revert "Remove trailing whitespace"

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  2 +-
 .../java/org/apache/bcel/classfile/Visitor.java    |  2 +-
 .../ConstantPoolModuleToStringTestCase.java        |  2 +-
 .../bcel/classfile/ConstantPoolTestCase.java       |  4 +-
 .../org/apache/bcel/classfile/UtilityTestCase.java |  2 +-
 src/test/java/org/apache/bcel/data/SWAP.java       |  2 +-
 .../java/org/apache/bcel/generic/JavaHome.java     |  2 +-
 .../java/org/apache/bcel/generic/TypeTestCase.java |  2 +-
 .../org/apache/bcel/util/BCELifierTestCase.java    |  2 +-
 .../apache/bcel/verifier/JiraBcel369TestCase.java  |  2 +-
 .../apache/bcel/verifier/JiraBcel370TestCase.java  | 20 +++++-----
 .../verifier/statics/Pass3aVerifierTestCase.java   | 44 +++++++++++-----------
 .../structurals/InstConstraintVisitorTestCase.java | 18 ++++-----
 13 files changed, 52 insertions(+), 52 deletions(-)


(commons-bcel) 01/02: Use current version of Mockito 4.

Posted by gg...@apache.org.
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 f20946d0b1d768617e34aa2ee7a69e2ff0899728
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 6 15:37:06 2024 -0500

    Use current version of Mockito 4.
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e830ae43..d875b295 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
     <commons.osgi.private />
     <commons.jira.id>BCEL</commons.jira.id>
     <commons.jira.pid>12314220</commons.jira.pid>
-    <mockito.version>4.8.1</mockito.version>
+    <mockito.version>4.11.0</mockito.version>
     <assertj.version>3.25.1</assertj.version>
     <jna.version>5.14.0</jna.version>
     <japicmp.skip>false</japicmp.skip>


(commons-bcel) 02/02: Revert "Remove trailing whitespace"

Posted by gg...@apache.org.
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 f3bcd0a7e163813436472b9cfd2f6e3cf0243486
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 6 15:37:21 2024 -0500

    Revert "Remove trailing whitespace"
    
    This reverts commit da48305845cf112c914fe0993c76fcc8ef43fef3.
---
 .../java/org/apache/bcel/classfile/Visitor.java    |  2 +-
 .../ConstantPoolModuleToStringTestCase.java        |  2 +-
 .../bcel/classfile/ConstantPoolTestCase.java       |  4 +-
 .../org/apache/bcel/classfile/UtilityTestCase.java |  2 +-
 src/test/java/org/apache/bcel/data/SWAP.java       |  2 +-
 .../java/org/apache/bcel/generic/JavaHome.java     |  2 +-
 .../java/org/apache/bcel/generic/TypeTestCase.java |  2 +-
 .../org/apache/bcel/util/BCELifierTestCase.java    |  2 +-
 .../apache/bcel/verifier/JiraBcel369TestCase.java  |  2 +-
 .../apache/bcel/verifier/JiraBcel370TestCase.java  | 20 +++++-----
 .../verifier/statics/Pass3aVerifierTestCase.java   | 44 +++++++++++-----------
 .../structurals/InstConstraintVisitorTestCase.java | 18 ++++-----
 12 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/src/main/java/org/apache/bcel/classfile/Visitor.java b/src/main/java/org/apache/bcel/classfile/Visitor.java
index 4f4b5c21..9a3388cf 100644
--- a/src/main/java/org/apache/bcel/classfile/Visitor.java
+++ b/src/main/java/org/apache/bcel/classfile/Visitor.java
@@ -230,7 +230,7 @@ public interface Visitor {
      * @param obj object to visit
      * @since 6.8.0
      */
-    default void visitStackMapType(final StackMapType obj) {
+    default void visitStackMapType(StackMapType obj) {
       // empty
     }
 
diff --git a/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java b/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java
index e7f08c96..8048b705 100644
--- a/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java
+++ b/src/test/java/org/apache/bcel/classfile/ConstantPoolModuleToStringTestCase.java
@@ -385,7 +385,7 @@ public class ConstantPoolModuleToStringTestCase {
             append(constantModule);
             append(constantModule.toString(pool));
             final String s = constantModule.toString(pool).trim();
-            final boolean condition = StringUtils.startsWithAny(s,
+            boolean condition = StringUtils.startsWithAny(s, 
                     "jdk.",
                     "java.",
                     "org.junit",
diff --git a/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java b/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java
index 3454a1a8..3c154fac 100644
--- a/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java
+++ b/src/test/java/org/apache/bcel/classfile/ConstantPoolTestCase.java
@@ -66,7 +66,7 @@ public class ConstantPoolTestCase extends AbstractTestCase {
                         // Next constant pool entry will be invalid so skip it
                         i++;
                     }
-                } catch (final Throwable t) {
+                } catch (Throwable t) {
                     t.printStackTrace();
                     fail();
                 }
@@ -92,7 +92,7 @@ public class ConstantPoolTestCase extends AbstractTestCase {
                         // Next constant pool entry will be invalid so skip it
                         i++;
                     }
-                } catch (final Throwable t) {
+                } catch (Throwable t) {
                     t.printStackTrace();
                     fail();
                 }
diff --git a/src/test/java/org/apache/bcel/classfile/UtilityTestCase.java b/src/test/java/org/apache/bcel/classfile/UtilityTestCase.java
index 54561d4c..8c3144b6 100644
--- a/src/test/java/org/apache/bcel/classfile/UtilityTestCase.java
+++ b/src/test/java/org/apache/bcel/classfile/UtilityTestCase.java
@@ -44,7 +44,7 @@ public class UtilityTestCase {
     @Test
     public void testCodeToString() throws Exception {
         final class CodeToString {
-            int[][] a = {};
+            int[][] a = new int[0][0];
 
             CodeToString() {
                 if (a instanceof int[][]) {
diff --git a/src/test/java/org/apache/bcel/data/SWAP.java b/src/test/java/org/apache/bcel/data/SWAP.java
index ce1e29a2..81a291e2 100644
--- a/src/test/java/org/apache/bcel/data/SWAP.java
+++ b/src/test/java/org/apache/bcel/data/SWAP.java
@@ -32,6 +32,6 @@ public class SWAP {
             return theClass.getConstructor(args);
         } catch (final NoSuchMethodException e) {
         }
-        return theClass.getConstructor();
+        return theClass.getConstructor(new Class[0]);
     }
 }
diff --git a/src/test/java/org/apache/bcel/generic/JavaHome.java b/src/test/java/org/apache/bcel/generic/JavaHome.java
index f23be553..e4d04d45 100644
--- a/src/test/java/org/apache/bcel/generic/JavaHome.java
+++ b/src/test/java/org/apache/bcel/generic/JavaHome.java
@@ -68,7 +68,7 @@ public class JavaHome {
 
     private static Stream<Path> find(final Path start, final int maxDepth, final BiPredicate<Path, BasicFileAttributes> matcher,
             final FileVisitOption... options) {
-        // TODO Apache Commons 2.14.0: Use FilesUncheck
+        // TODO Apache Commons 2.14.0: Use FilesUncheck 
         return Files.exists(start) ? Uncheck.apply(Files::find, start, maxDepth, matcher, options) : Stream.empty();
     }
 
diff --git a/src/test/java/org/apache/bcel/generic/TypeTestCase.java b/src/test/java/org/apache/bcel/generic/TypeTestCase.java
index 303a75ba..83780589 100644
--- a/src/test/java/org/apache/bcel/generic/TypeTestCase.java
+++ b/src/test/java/org/apache/bcel/generic/TypeTestCase.java
@@ -91,7 +91,7 @@ public class TypeTestCase {
                 for (final InstructionHandle instructionHandle : instructionList) {
                     instructionHandle.accept(new EmptyVisitor() {
                         @Override
-                        public void visitLDC(final LDC obj) {
+                        public void visitLDC(LDC obj) {
                             assertNotNull(obj.getValue(cpg));
                         }
                     });
diff --git a/src/test/java/org/apache/bcel/util/BCELifierTestCase.java b/src/test/java/org/apache/bcel/util/BCELifierTestCase.java
index 8ab68d6c..1cdeff2d 100644
--- a/src/test/java/org/apache/bcel/util/BCELifierTestCase.java
+++ b/src/test/java/org/apache/bcel/util/BCELifierTestCase.java
@@ -174,7 +174,7 @@ public class BCELifierTestCase extends AbstractTestCase {
 
     /*
      * Dumps a class using "javap" and compare with the same class recreated using BCELifier, "javac", "java" and dumped with "javap".
-     *
+     * 
      * TODO: detect if JDK present and skip test if not
      */
     @ParameterizedTest
diff --git a/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java b/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java
index 5a8502d1..bfd84f28 100644
--- a/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java
+++ b/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java
@@ -109,7 +109,7 @@ Slots used: 0 MaxStack: 1.
     at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(Pass3bVerifier.java:386)
     ... 74 more
      * }</pre>
-     *
+     * 
      * @throws ClassNotFoundException
      */
     @Test
diff --git a/src/test/java/org/apache/bcel/verifier/JiraBcel370TestCase.java b/src/test/java/org/apache/bcel/verifier/JiraBcel370TestCase.java
index a92a9224..659a9abe 100644
--- a/src/test/java/org/apache/bcel/verifier/JiraBcel370TestCase.java
+++ b/src/test/java/org/apache/bcel/verifier/JiraBcel370TestCase.java
@@ -46,19 +46,19 @@ public class JiraBcel370TestCase extends AbstractTestCase {
     public void testLdcGetType(final String classFileName) throws Exception {
         try (FileInputStream file = new FileInputStream(classFileName)) {
             final ClassParser parser = new ClassParser(file, new File(classFileName).getName());
-            final JavaClass clazz = parser.parse();
-
-            final Method[] methods = clazz.getMethods();
-
-            final ConstantPoolGen cp = new ConstantPoolGen(clazz.getConstantPool());
-            final MethodGen methodGen = new MethodGen(methods[0], classFileName, cp);
-
+            JavaClass clazz = parser.parse();
+            
+            Method[] methods = clazz.getMethods();
+            
+            ConstantPoolGen cp = new ConstantPoolGen(clazz.getConstantPool());
+            MethodGen methodGen = new MethodGen(methods[0], classFileName, cp);
+            
             // The first instruction is an LDC CONSTANT_Dynamic added by Jacoco
-            final Instruction instruction = methodGen.getInstructionList().getInstructions()[0];
+            Instruction instruction = methodGen.getInstructionList().getInstructions()[0];
 
             instruction.accept(new EmptyVisitor() {
                 @Override
-                public void visitLDC(final LDC ldc) {
+                public void visitLDC(LDC ldc) {
                     // Without the change to LDC.getType() this fails because the tag is CONSTANT_Dynamic
                     ldc.getType(cp);
                 }
@@ -72,7 +72,7 @@ public class JiraBcel370TestCase extends AbstractTestCase {
         "com.foo.Foo"
     })
     // @formatter:on
-    public void testVerify(final String className) throws ClassNotFoundException {
+    public void testVerify(String className) throws ClassNotFoundException {
         // Without the changes to the verifier this fails because it doesn't allow LDC CONSTANT_Dynamic
         Verifier.verifyType(className);
     }
diff --git a/src/test/java/org/apache/bcel/verifier/statics/Pass3aVerifierTestCase.java b/src/test/java/org/apache/bcel/verifier/statics/Pass3aVerifierTestCase.java
index c368c392..7cda6a87 100644
--- a/src/test/java/org/apache/bcel/verifier/statics/Pass3aVerifierTestCase.java
+++ b/src/test/java/org/apache/bcel/verifier/statics/Pass3aVerifierTestCase.java
@@ -72,62 +72,62 @@ class Pass3aVerifierTestCase {
     }
     @AfterAll
     public static void restoreRepository() {
-        // We have set our mock repository, revert the change
+        // We have set our mock repository, revert the change 
         Repository.setRepository(SyntheticRepository.getInstance());
     }
     private Verifier verifier;
     private org.apache.bcel.util.Repository repository;
 
     private ConstantPool cp;
-
+    
     private JavaClass javaClass;
-
+    
     @ParameterizedTest
     @MethodSource("constantsNotSupportedByLdc")
-    public void rejectLdcConstant(final Constant constant) {
+    public void rejectLdcConstant(Constant constant) {
         // LDC the constant 0 and then return
-        final byte[] methodCode = {
+        byte[] methodCode = new byte[] {
                 Const.LDC,
                 0,
                 0,
                 (byte) Const.RETURN,
         };
-
-        final Code code = new Code(0, 0, 0, 0, methodCode, new CodeException[0], new Attribute[0], cp);
+        
+        Code code = new Code(0, 0, 0, 0, methodCode, new CodeException[0], new Attribute[0], cp);
 
         when(cp.getConstantPool()).thenReturn(new Constant[] {constant});
-
-        final Attribute[] attributes = {code};
-        final Method method = new Method(0, 0, 0, attributes, cp);
-
+        
+        Attribute[] attributes = new Attribute[] {code};
+        Method method = new Method(0, 0, 0, attributes, cp);
+        
         when(javaClass.getMethods()).thenReturn(new Method[] {method});
-
-        final Pass3aVerifier pass3aVerifier = new Pass3aVerifier(verifier, 0);
-        final VerificationResult verificationResult = pass3aVerifier.do_verify();
-
+        
+        Pass3aVerifier pass3aVerifier = new Pass3aVerifier(verifier, 0);
+        VerificationResult verificationResult = pass3aVerifier.do_verify();
+        
         assertThat(verificationResult.getStatus()).isEqualTo(VerificationResult.VERIFIED_REJECTED);
         assertThat(verificationResult.getMessage()).startsWith("Instruction ldc[18](2) 0 constraint violated: Operand of LDC");
     }
-
+    
     @BeforeEach
     void setup() throws ClassNotFoundException {
-        final String className = "org.apache.bcel.verifier.statics.Pass3aVerifierTestCase.foo";
-
+        String className = "org.apache.bcel.verifier.statics.Pass3aVerifierTestCase.foo";
+        
         verifier = spy(VerifierFactory.getVerifier(className));
         repository = mock(org.apache.bcel.util.Repository.class);
         cp = mock(ConstantPool.class);
         javaClass = mock(JavaClass.class);
-
+        
         // Mock the verifier
         doReturn(VerificationResult.VR_OK).when(verifier).doPass2();
-
+        
         // Mock the repository
         Repository.setRepository(repository);
         when(repository.loadClass(className)).thenReturn(javaClass);
-
+        
         // Mock the constant pool
         when(cp.getConstantPool()).thenReturn(new Constant[] {new ConstantModule(0)});
-
+        
         // Mock the java class
         when(javaClass.getConstantPool()).thenReturn(cp);
     }
diff --git a/src/test/java/org/apache/bcel/verifier/structurals/InstConstraintVisitorTestCase.java b/src/test/java/org/apache/bcel/verifier/structurals/InstConstraintVisitorTestCase.java
index 72d4c04b..3ebc5e29 100644
--- a/src/test/java/org/apache/bcel/verifier/structurals/InstConstraintVisitorTestCase.java
+++ b/src/test/java/org/apache/bcel/verifier/structurals/InstConstraintVisitorTestCase.java
@@ -29,22 +29,22 @@ import org.junit.jupiter.params.provider.MethodSource;
 
 public class InstConstraintVisitorTestCase {
     private ConstantPoolGen cp;
-
+    
     @ParameterizedTest
     @MethodSource("org.apache.bcel.verifier.statics.Pass3aVerifierTestCase#constantsNotSupportedByLdc")
-    public void rejectLdcConstantModule(final Constant constant) {
-        final InstConstraintVisitor visitor = new InstConstraintVisitor();
-
+    public void rejectLdcConstantModule(Constant constant) {
+        InstConstraintVisitor visitor = new InstConstraintVisitor();
+        
         cp = mock(ConstantPoolGen.class);
         when(cp.getConstant(0)).thenReturn(constant);
-
+        
         visitor.setConstantPoolGen(cp);
-
-        final LDC ldc = new LDC(0);
-
+        
+        LDC ldc = new LDC(0);
+        
         assertThatCode(() -> visitor.visitLDC(ldc)).hasMessageStartingWith("Instruction LDC constraint violated: Referenced constant should be a");
     }
-
+    
     @BeforeEach
     public void setup() {
         cp = mock(ConstantPoolGen.class);