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

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

commit 800fd5eba37ccb83fb5f401e3d8d31f86dd141a3
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jul 3 19:03:40 2026 +0000

    Sort members.
---
 .../org/apache/bcel/classfile/ElementValue.java    | 28 ++++++++---------
 .../org/apache/bcel/generic/ConstantPoolGen.java   | 34 ++++++++++----------
 .../generic/ParameterAnnotationVisibilityTest.java | 36 +++++++++++-----------
 3 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/main/java/org/apache/bcel/classfile/ElementValue.java 
b/src/main/java/org/apache/bcel/classfile/ElementValue.java
index 40e83ea8..cd576bb6 100644
--- a/src/main/java/org/apache/bcel/classfile/ElementValue.java
+++ b/src/main/java/org/apache/bcel/classfile/ElementValue.java
@@ -107,20 +107,6 @@ public abstract class ElementValue {
         return readElementValue(input, cpool, 0);
     }
 
-    /**
-     * Reads an {@code element_value} as an {@code ElementValue}.
-     *
-     * @param input Raw data input.
-     * @param cpool Constant pool.
-     * @param arrayNesting level of current array nesting.
-     * @return a new ElementValue.
-     * @throws IOException if an I/O error occurs.
-     * @since 6.7.0
-     */
-    public static ElementValue readElementValue(final DataInput input, final 
ConstantPool cpool, final int arrayNesting) throws IOException {
-        return readElementValue(input, cpool, false, arrayNesting);
-    }
-
     static ElementValue readElementValue(final DataInput input, final 
ConstantPool cpool, final boolean isRuntimeVisible, int arrayNesting)
             throws IOException {
         final byte tag = input.readByte();
@@ -163,6 +149,20 @@ public abstract class ElementValue {
         }
     }
 
+    /**
+     * Reads an {@code element_value} as an {@code ElementValue}.
+     *
+     * @param input Raw data input.
+     * @param cpool Constant pool.
+     * @param arrayNesting level of current array nesting.
+     * @return a new ElementValue.
+     * @throws IOException if an I/O error occurs.
+     * @since 6.7.0
+     */
+    public static ElementValue readElementValue(final DataInput input, final 
ConstantPool cpool, final int arrayNesting) throws IOException {
+        return readElementValue(input, cpool, false, arrayNesting);
+    }
+
     /**
      * @deprecated (since 6.0) will be made private and final; do not access 
directly, use getter.
      */
diff --git a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java 
b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
index 4c3a1740..0c3b490e 100644
--- a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
+++ b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
@@ -59,6 +59,23 @@ public class ConstantPoolGen {
 
     private static final String FIELDREF_DELIM = "&";
 
+    /**
+     * Builds a lookup key that stays collision-free even when the parts 
contain the ASCII characters used as
+     * delimiters above. Class, member and signature names read from a class 
file may legally contain those characters
+     * (the JVMS only forbids {@code . ; [ /} and, for members, {@code < >}), 
so each part is prefixed with its length
+     * to keep distinct triples distinct.
+     *
+     * @param parts the key parts.
+     * @return a collision-free key.
+     */
+    private static String toKey(final String... parts) {
+        final StringBuilder buf = new StringBuilder();
+        for (final String part : parts) {
+            buf.append(part.length()).append(':').append(part);
+        }
+        return buf.toString();
+    }
+
     /**
      * @deprecated (since 6.0) will be made private; do not access directly, 
use getter/setter
      */
@@ -545,23 +562,6 @@ public class ConstantPoolGen {
         return map.computeIfAbsent(key, k -> Integer.valueOf(value));
     }
 
-    /**
-     * Builds a lookup key that stays collision-free even when the parts 
contain the ASCII characters used as
-     * delimiters above. Class, member and signature names read from a class 
file may legally contain those characters
-     * (the JVMS only forbids {@code . ; [ /} and, for members, {@code < >}), 
so each part is prefixed with its length
-     * to keep distinct triples distinct.
-     *
-     * @param parts the key parts.
-     * @return a collision-free key.
-     */
-    private static String toKey(final String... parts) {
-        final StringBuilder buf = new StringBuilder();
-        for (final String part : parts) {
-            buf.append(part.length()).append(':').append(part);
-        }
-        return buf.toString();
-    }
-
     /**
      * Gets a constant pool entry at the specified index.
      *
diff --git 
a/src/test/java/org/apache/bcel/generic/ParameterAnnotationVisibilityTest.java 
b/src/test/java/org/apache/bcel/generic/ParameterAnnotationVisibilityTest.java
index f4ddce12..8b9a3a19 100644
--- 
a/src/test/java/org/apache/bcel/generic/ParameterAnnotationVisibilityTest.java
+++ 
b/src/test/java/org/apache/bcel/generic/ParameterAnnotationVisibilityTest.java
@@ -40,10 +40,6 @@ import org.junit.jupiter.api.Test;
  */
 class ParameterAnnotationVisibilityTest extends AbstractTest {
 
-    private JavaClass loadTestClass() throws ClassNotFoundException {
-        return getTestJavaClass(PACKAGE_BASE_NAME + 
".data.AnnotatedWithCombinedAnnotation");
-    }
-
     private Method getConstructor(final JavaClass jc) {
         for (final Method method : jc.getMethods()) {
             if (Const.CONSTRUCTOR_NAME.equals(method.getName())) {
@@ -53,6 +49,10 @@ class ParameterAnnotationVisibilityTest extends AbstractTest 
{
         return null;
     }
 
+    private JavaClass loadTestClass() throws ClassNotFoundException {
+        return getTestJavaClass(PACKAGE_BASE_NAME + 
".data.AnnotatedWithCombinedAnnotation");
+    }
+
     @Test
     void testNestedAnnotationValueIsRuntimeVisible() throws 
ClassNotFoundException {
         final JavaClass jc = loadTestClass();
@@ -74,6 +74,20 @@ class ParameterAnnotationVisibilityTest extends AbstractTest 
{
         assertTrue(found, "no nested annotation values found in test data");
     }
 
+    @Test
+    void testParameterAnnotationVisibilitySurvivesMethodGen() throws 
ClassNotFoundException {
+        final JavaClass jc = loadTestClass();
+        final Method init = getConstructor(jc);
+        final ConstantPoolGen cp = new ConstantPoolGen(jc.getConstantPool());
+        final MethodGen mg = new MethodGen(init, jc.getClassName(), cp);
+        mg.getAnnotationsOnParameter(1); // unpack the existing parameter 
annotations before rebuilding
+        final Method out = mg.getMethod();
+        
assertNotNull(out.getAttribute(Const.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS),
+            "runtime-visible parameter annotation dropped on MethodGen 
round-trip");
+        
assertNull(out.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS),
+            "runtime-visible parameter annotation downgraded to invisible on 
MethodGen round-trip");
+    }
+
     @Test
     void testParsedParameterAnnotationIsRuntimeVisible() throws 
ClassNotFoundException {
         final JavaClass jc = loadTestClass();
@@ -88,18 +102,4 @@ class ParameterAnnotationVisibilityTest extends 
AbstractTest {
         }
         assertTrue(found, "no parameter annotations found in test data");
     }
-
-    @Test
-    void testParameterAnnotationVisibilitySurvivesMethodGen() throws 
ClassNotFoundException {
-        final JavaClass jc = loadTestClass();
-        final Method init = getConstructor(jc);
-        final ConstantPoolGen cp = new ConstantPoolGen(jc.getConstantPool());
-        final MethodGen mg = new MethodGen(init, jc.getClassName(), cp);
-        mg.getAnnotationsOnParameter(1); // unpack the existing parameter 
annotations before rebuilding
-        final Method out = mg.getMethod();
-        
assertNotNull(out.getAttribute(Const.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS),
-            "runtime-visible parameter annotation dropped on MethodGen 
round-trip");
-        
assertNull(out.getAttribute(Const.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS),
-            "runtime-visible parameter annotation downgraded to invisible on 
MethodGen round-trip");
-    }
 }

Reply via email to