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/17 11:30:40 UTC

[commons-bcel] branch master updated (a946274f -> ffdad2d0)

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 a946274f Use diamonds
     new c895155a Comment
     new 3aab265e Format tweak
     new ffdad2d0 Test BCEL-368

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:
 .../bcel/classfile/JDKClassDumpTestCase.java       |   3 +-
 .../TestJira368.java}                              | 106 ++++++++++++---------
 .../org/apache/bcel/util/BCELifierTestCase.java    |   5 +-
 src/test/resources/jira368/Test.class              | Bin 0 -> 162 bytes
 4 files changed, 65 insertions(+), 49 deletions(-)
 copy src/test/java/org/apache/bcel/{util/ClassPathTestCase.java => classfile/TestJira368.java} (50%)
 create mode 100644 src/test/resources/jira368/Test.class


[commons-bcel] 02/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 3aab265e75b21f85d4bfb3918be88970281cd749
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Jun 17 07:17:56 2023 -0400

    Format tweak
---
 src/test/java/org/apache/bcel/classfile/JDKClassDumpTestCase.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/bcel/classfile/JDKClassDumpTestCase.java b/src/test/java/org/apache/bcel/classfile/JDKClassDumpTestCase.java
index c2409612..96864258 100644
--- a/src/test/java/org/apache/bcel/classfile/JDKClassDumpTestCase.java
+++ b/src/test/java/org/apache/bcel/classfile/JDKClassDumpTestCase.java
@@ -64,7 +64,8 @@ public class JDKClassDumpTestCase {
                 final String name = e.getName();
                 if (name.endsWith(JavaClass.EXTENSION)) {
                     // System.out.println("Parsing " + name);
-                    try (InputStream inputStream1 = jar.getInputStream(e); InputStream inputStream2 = jar.getInputStream(e);) {
+                    try (InputStream inputStream1 = jar.getInputStream(e);
+                            InputStream inputStream2 = jar.getInputStream(e);) {
                         compare(new ClassParser(inputStream1, name).parse(), inputStream2, name);
                     }
                 }


[commons-bcel] 03/03: Test BCEL-368

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 ffdad2d0e2fd4187db556b88267a80ac3f4bb1f1
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Jun 17 07:30:36 2023 -0400

    Test BCEL-368
---
 .../org/apache/bcel/classfile/TestJira368.java     |  60 +++++++++++++++++++++
 src/test/resources/jira368/Test.class              | Bin 0 -> 162 bytes
 2 files changed, 60 insertions(+)

diff --git a/src/test/java/org/apache/bcel/classfile/TestJira368.java b/src/test/java/org/apache/bcel/classfile/TestJira368.java
new file mode 100644
index 00000000..f3491d7f
--- /dev/null
+++ b/src/test/java/org/apache/bcel/classfile/TestJira368.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.bcel.classfile;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests BCEL-368.
+ */
+public class TestJira368 {
+
+    private JavaClass parseJavaClass() throws IOException {
+        return new ClassParser("src/test/resources/jira368/Test.class").parse();
+    }
+
+    @Test
+    public void testMethodCodeStringBrief() throws Exception {
+        for (Method method : parseJavaClass().getMethods()) {
+            final String string = method.getCode().toString(false);
+            // System.out.println(string);
+            assertNotNull(string);
+        }
+    }
+
+    @Test
+    public void testMethodCodeStringVerbose() throws Exception {
+        for (Method method : parseJavaClass().getMethods()) {
+            final String string = method.getCode().toString(true);
+            // System.out.println(string);
+            assertNotNull(string);
+        }
+    }
+
+    @Test
+    public void testMethodSignature() throws Exception {
+        final String string = parseJavaClass().toString();
+        // System.out.println(string);
+        assertNotNull(string);
+    }
+
+}
diff --git a/src/test/resources/jira368/Test.class b/src/test/resources/jira368/Test.class
new file mode 100644
index 00000000..2f5ce45c
Binary files /dev/null and b/src/test/resources/jira368/Test.class differ


[commons-bcel] 01/03: Comment

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 c895155aa7f13245edf559dc71f26170842b9dc8
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Jun 17 07:03:48 2023 -0400

    Comment
---
 src/test/java/org/apache/bcel/util/BCELifierTestCase.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/bcel/util/BCELifierTestCase.java b/src/test/java/org/apache/bcel/util/BCELifierTestCase.java
index da0d1e29..1cdeff2d 100644
--- a/src/test/java/org/apache/bcel/util/BCELifierTestCase.java
+++ b/src/test/java/org/apache/bcel/util/BCELifierTestCase.java
@@ -173,8 +173,9 @@ public class BCELifierTestCase extends AbstractTestCase {
     }
 
     /*
-     * Dump 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
+     * 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
     @ValueSource(strings = {