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 2023/06/03 21:37:35 UTC

[commons-bcel] branch master updated (99863daf -> c68bba72)

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 99863daf [BCEL-369] org.apache.bcel.verifier.exc.AssertionViolatedException from method return in subroutine
     new 57fccbde Format tweak
     new 0e70219b Better method names
     new c68bba72 [BCEL-369] org.apache.bcel.verifier.exc.AssertionViolatedException from method return in subroutine

The 3 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:
 .../java/org/apache/bcel/AbstractTestCase.java     |  64 ++++++++++-----------
 .../GeneratingAnnotatedClassesTestCase.java        |  10 ++--
 .../apache/bcel/generic/JiraBcel362TestCase.java   |   2 +
 .../apache/bcel/verifier/JiraBcel369TestCase.java  |  13 ++++-
 src/test/resources/issue369/Test.class             | Bin 0 -> 274 bytes
 5 files changed, 50 insertions(+), 39 deletions(-)
 create mode 100644 src/test/resources/issue369/Test.class


[commons-bcel] 02/03: Better method names

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 0e70219ba3ceb8fb65f3a61ad17cfd1e86c9830b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 3 17:30:41 2023 -0400

    Better method names
---
 .../java/org/apache/bcel/AbstractTestCase.java     | 64 +++++++++++-----------
 .../GeneratingAnnotatedClassesTestCase.java        | 10 ++--
 2 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/test/java/org/apache/bcel/AbstractTestCase.java b/src/test/java/org/apache/bcel/AbstractTestCase.java
index af1d5059..e4e03b9c 100644
--- a/src/test/java/org/apache/bcel/AbstractTestCase.java
+++ b/src/test/java/org/apache/bcel/AbstractTestCase.java
@@ -85,6 +85,38 @@ public abstract class AbstractTestCase {
         return new File(TESTDATA, name);
     }
 
+    /**
+     * Deletes a file under the TESTDATA directory
+     *
+     * @param name
+     * @return
+     */
+    protected boolean delete(final String name) {
+        return new File(TESTDATA, name).delete();
+    }
+
+    /**
+     * Deletes a directory and file under the TESTDATA directory
+     *
+     * @param dir
+     * @param name
+     * @return true if the file was deleted
+     */
+    protected boolean delete(final String dir, final String name) {
+        // The parameter is relative to the TESTDATA dir
+        final boolean b = delete(dir + File.separator + name);
+        final File testDir = new File(TESTDATA, dir);
+        final String[] files = testDir.list();
+        if (files == null || files.length == 0) {
+            if (!testDir.delete()) {
+                System.err.println("Failed to remove: " + testDir);
+            }
+        } else {
+            System.err.println("Non-empty directory: " + testDir);
+        }
+        return b;
+    }
+
     protected String dumpAnnotationEntries(final AnnotationEntry[] as) {
         final StringBuilder result = new StringBuilder();
         result.append("[");
@@ -163,36 +195,4 @@ public abstract class AbstractTestCase {
         return SyntheticRepository.getInstance().loadClass(name);
     }
 
-    /**
-     * Delete a file under the TESTDATA directory
-     *
-     * @param name
-     * @return
-     */
-    protected boolean wipe(final String name) {
-        return new File(TESTDATA, name).delete();
-    }
-
-    /**
-     * Delete a directory and file under the TESTDATA directory
-     *
-     * @param dir
-     * @param name
-     * @return true if the file was deleted
-     */
-    protected boolean wipe(final String dir, final String name) {
-        // The parameter is relative to the TESTDATA dir
-        final boolean b = wipe(dir + File.separator + name);
-        final File testDir = new File(TESTDATA, dir);
-        final String[] files = testDir.list();
-        if (files == null || files.length == 0) {
-            if (!testDir.delete()) {
-                System.err.println("Failed to remove: " + testDir);
-            }
-        } else {
-            System.err.println("Non-empty directory: " + testDir);
-        }
-        return b;
-    }
-
 }
diff --git a/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java b/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
index a2d77982..762f6fdb 100644
--- a/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
+++ b/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
@@ -390,7 +390,7 @@ public class GeneratingAnnotatedClassesTestCase extends AbstractTestCase {
         i = mg.getAnnotationEntries().length;
         assertEquals(1, i, "Wrong number of annotations on the main 'MethodGen'");
 
-        assertTrue(wipe("temp1", "HelloWorld.class"));
+        assertTrue(delete("temp1", "HelloWorld.class"));
     }
 
     /**
@@ -427,8 +427,8 @@ public class GeneratingAnnotatedClassesTestCase extends AbstractTestCase {
         assertEquals(1, mainMethod2.getAnnotationEntries().length, "Wrong number of annotations on the 'MethodGen'");
         mainMethod2.removeAnnotationEntries();
         assertEquals(0, mainMethod2.getAnnotationEntries().length, 0, "Wrong number of annotations on the 'MethodGen'");
-        assertTrue(wipe("temp2", "HelloWorld.class"));
-        assertTrue(wipe("temp3", "HelloWorld.class"));
+        assertTrue(delete("temp2", "HelloWorld.class"));
+        assertTrue(delete("temp3", "HelloWorld.class"));
     }
 
     /**
@@ -442,7 +442,7 @@ public class GeneratingAnnotatedClassesTestCase extends AbstractTestCase {
         cgen.addAnnotationEntry(createFruitAnnotation(cp, "Pineapple"));
         assertEquals(2, cgen.getAnnotationEntries().length, "Wrong number of annotations");
         dumpClass(cgen, "SimpleAnnotatedClass.class");
-        assertTrue(wipe("SimpleAnnotatedClass.class"));
+        assertTrue(delete("SimpleAnnotatedClass.class"));
     }
 
     /**
@@ -458,7 +458,7 @@ public class GeneratingAnnotatedClassesTestCase extends AbstractTestCase {
         dumpClass(cgen, "SimpleAnnotatedClass.class");
         final JavaClass jc2 = getClassFrom(".", "SimpleAnnotatedClass");
         jc2.getAnnotationEntries();
-        assertTrue(wipe("SimpleAnnotatedClass.class"));
+        assertTrue(delete("SimpleAnnotatedClass.class"));
         // System.err.println(jc2.toString());
     }
 


[commons-bcel] 03/03: [BCEL-369] org.apache.bcel.verifier.exc.AssertionViolatedException from method return in subroutine

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 c68bba722e87e0d50e0b49d2773b91b515f59df2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 3 17:37:21 2023 -0400

    [BCEL-369] org.apache.bcel.verifier.exc.AssertionViolatedException from
    method
    return in subroutine
    
    Add disabled test case. Class file needs to be reanmed by OP.
---
 .../org/apache/bcel/verifier/JiraBcel369TestCase.java     |  13 +++++++++++--
 src/test/resources/issue369/Test.class                    | Bin 0 -> 274 bytes
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java b/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java
index bc628463..57424b91 100644
--- a/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java
+++ b/src/test/java/org/apache/bcel/verifier/JiraBcel369TestCase.java
@@ -17,15 +17,24 @@
 
 package org.apache.bcel.verifier;
 
+import org.apache.bcel.AbstractTestCase;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
  * Tests BCEL-369.
  */
-public class JiraBcel369TestCase {
+public class JiraBcel369TestCase extends AbstractTestCase {
 
     @Test
-    public void testBcel369() throws ClassNotFoundException {
+    public void testCompileAndVerify() throws ClassNotFoundException {
         Verifier.verifyType(org.apache.bcel.verifier.JiraBcel369TestFixture.class.getName());
     }
+
+    @Test
+    @Disabled
+    public void testCompiledClass() throws ClassNotFoundException {
+        Verifier.verifyType("issue369.Test");
+    }
+
 }
diff --git a/src/test/resources/issue369/Test.class b/src/test/resources/issue369/Test.class
new file mode 100644
index 00000000..2c9476c0
Binary files /dev/null and b/src/test/resources/issue369/Test.class differ


[commons-bcel] 01/03: Format tweak

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 57fccbde05b0f30f656f760fc442a2ec68781c50
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 3 17:28:13 2023 -0400

    Format tweak
---
 src/test/java/org/apache/bcel/generic/JiraBcel362TestCase.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/test/java/org/apache/bcel/generic/JiraBcel362TestCase.java b/src/test/java/org/apache/bcel/generic/JiraBcel362TestCase.java
index 9a04f79b..b7959743 100644
--- a/src/test/java/org/apache/bcel/generic/JiraBcel362TestCase.java
+++ b/src/test/java/org/apache/bcel/generic/JiraBcel362TestCase.java
@@ -29,10 +29,12 @@ import org.junit.jupiter.api.Test;
  * the corresponding constant is found after parsing.
  */
 public class JiraBcel362TestCase extends AbstractTestCase {
+
     @Test
     public void testProcessConstantPoolWithCondyEntry() throws ClassNotFoundException {
         final JavaClass clazz = getTestJavaClass("issue362.Bcel362");
         final ConstantPoolGen constantPoolGen = assertDoesNotThrow(() -> new ConstantPoolGen(clazz.getConstantPool()));
         assertTrue(constantPoolGen.lookupUtf8("$jacocoData") != -1);
     }
+
 }