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 2022/10/22 20:22:50 UTC

[commons-bcel] branch master updated (fcb6febf -> cc7982a9)

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 fcb6febf Use camel case for parameter names and local variable names
     new 31ab85a7 Use camel case for parameter names and local variable names
     new cc7982a9 Use camel case for (package) private names

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:
 src/main/java/org/apache/bcel/Repository.java      | 12 ++++----
 .../java/org/apache/bcel/generic/LOOKUPSWITCH.java | 10 +++---
 src/main/java/org/apache/bcel/generic/SWITCH.java  |  4 +--
 src/main/java/org/apache/bcel/generic/Select.java  | 12 ++++----
 .../java/org/apache/bcel/generic/TABLESWITCH.java  | 16 +++++-----
 .../bcel/verifier/statics/Pass2Verifier.java       | 32 +++++++++----------
 .../bcel/verifier/statics/Pass3aVerifier.java      | 36 +++++++++++-----------
 .../bcel/verifier/structurals/Pass3bVerifier.java  | 10 +++---
 .../GeneratingAnnotatedClassesTestCase.java        |  4 +--
 9 files changed, 68 insertions(+), 68 deletions(-)


[commons-bcel] 02/02: Use camel case for (package) private 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 cc7982a9e370546ad3ccffcf47dfbe3de313fb62
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Oct 22 16:22:45 2022 -0400

    Use camel case for (package) private names
---
 src/main/java/org/apache/bcel/Repository.java      | 12 ++++----
 .../java/org/apache/bcel/generic/LOOKUPSWITCH.java | 10 +++---
 src/main/java/org/apache/bcel/generic/SWITCH.java  |  4 +--
 src/main/java/org/apache/bcel/generic/Select.java  |  8 ++---
 .../java/org/apache/bcel/generic/TABLESWITCH.java  | 16 +++++-----
 .../bcel/verifier/statics/Pass2Verifier.java       | 32 +++++++++----------
 .../bcel/verifier/statics/Pass3aVerifier.java      | 36 +++++++++++-----------
 .../bcel/verifier/structurals/Pass3bVerifier.java  | 10 +++---
 .../GeneratingAnnotatedClassesTestCase.java        |  4 +--
 9 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/src/main/java/org/apache/bcel/Repository.java b/src/main/java/org/apache/bcel/Repository.java
index cc262713..9aa25710 100644
--- a/src/main/java/org/apache/bcel/Repository.java
+++ b/src/main/java/org/apache/bcel/Repository.java
@@ -128,7 +128,7 @@ public abstract class Repository {
     /**
      * Equivalent to runtime "instanceof" operator.
      *
-     * @return true, if clazz is an instance of super_class
+     * @return true, if clazz is an instance of superclass
      * @throws ClassNotFoundException if any superclasses or superinterfaces of clazz can't be found
      */
     public static boolean instanceOf(final JavaClass clazz, final JavaClass superclass) throws ClassNotFoundException {
@@ -136,15 +136,15 @@ public abstract class Repository {
     }
 
     /**
-     * @return true, if clazz is an instance of super_class
-     * @throws ClassNotFoundException if super_class can't be found
+     * @return true, if clazz is an instance of superclass
+     * @throws ClassNotFoundException if superclass can't be found
      */
     public static boolean instanceOf(final JavaClass clazz, final String superclass) throws ClassNotFoundException {
         return instanceOf(clazz, lookupClass(superclass));
     }
 
     /**
-     * @return true, if clazz is an instance of super_class
+     * @return true, if clazz is an instance of superclass
      * @throws ClassNotFoundException if clazz can't be found
      */
     public static boolean instanceOf(final String clazz, final JavaClass superclass) throws ClassNotFoundException {
@@ -152,8 +152,8 @@ public abstract class Repository {
     }
 
     /**
-     * @return true, if clazz is an instance of super_class
-     * @throws ClassNotFoundException if either clazz or super_class can't be found
+     * @return true, if clazz is an instance of superclass
+     * @throws ClassNotFoundException if either clazz or superclass can't be found
      */
     public static boolean instanceOf(final String clazz, final String superclass) throws ClassNotFoundException {
         return instanceOf(lookupClass(clazz), lookupClass(superclass));
diff --git a/src/main/java/org/apache/bcel/generic/LOOKUPSWITCH.java b/src/main/java/org/apache/bcel/generic/LOOKUPSWITCH.java
index f6cb8f52..0695de1b 100644
--- a/src/main/java/org/apache/bcel/generic/LOOKUPSWITCH.java
+++ b/src/main/java/org/apache/bcel/generic/LOOKUPSWITCH.java
@@ -37,9 +37,9 @@ public class LOOKUPSWITCH extends Select {
     public LOOKUPSWITCH(final int[] match, final InstructionHandle[] targets, final InstructionHandle defaultTarget) {
         super(org.apache.bcel.Const.LOOKUPSWITCH, match, targets, defaultTarget);
         /* alignment remainder assumed 0 here, until dump time. */
-        final short length = (short) (9 + getMatch_length() * 8);
+        final short length = (short) (9 + getMatchLength() * 8);
         super.setLength(length);
-        setFixed_length(length);
+        setFixedLength(length);
     }
 
     /**
@@ -65,7 +65,7 @@ public class LOOKUPSWITCH extends Select {
     @Override
     public void dump(final DataOutputStream out) throws IOException {
         super.dump(out);
-        final int matchLength = getMatch_length();
+        final int matchLength = getMatchLength();
         out.writeInt(matchLength); // npairs
         for (int i = 0; i < matchLength; i++) {
             out.writeInt(super.getMatch(i)); // match-offset pairs
@@ -80,9 +80,9 @@ public class LOOKUPSWITCH extends Select {
     protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
         super.initFromFile(bytes, wide); // reads padding
         final int matchLength = bytes.readInt();
-        setMatch_length(matchLength);
+        setMatchLength(matchLength);
         final short fixedLength = (short) (9 + matchLength * 8);
-        setFixed_length(fixedLength);
+        setFixedLength(fixedLength);
         final short length = (short) (matchLength + super.getPadding());
         super.setLength(length);
         super.setMatches(new int[matchLength]);
diff --git a/src/main/java/org/apache/bcel/generic/SWITCH.java b/src/main/java/org/apache/bcel/generic/SWITCH.java
index 2454a688..357f268c 100644
--- a/src/main/java/org/apache/bcel/generic/SWITCH.java
+++ b/src/main/java/org/apache/bcel/generic/SWITCH.java
@@ -96,9 +96,9 @@ public final class SWITCH implements CompoundInstruction {
     /**
      * @return match is sorted in ascending order with no gap bigger than max_gap?
      */
-    private boolean matchIsOrdered(final int max_gap) {
+    private boolean matchIsOrdered(final int maxGap) {
         for (int i = 1; i < matchLength; i++) {
-            if (match[i] - match[i - 1] > max_gap) {
+            if (match[i] - match[i - 1] > maxGap) {
                 return false;
             }
         }
diff --git a/src/main/java/org/apache/bcel/generic/Select.java b/src/main/java/org/apache/bcel/generic/Select.java
index 58c6671d..c2647a9c 100644
--- a/src/main/java/org/apache/bcel/generic/Select.java
+++ b/src/main/java/org/apache/bcel/generic/Select.java
@@ -153,7 +153,7 @@ public abstract class Select extends BranchInstruction implements VariableLength
      * @return the fixed_length
      * @since 6.0
      */
-    final int getFixed_length() {
+    final int getFixedLength() {
         return fixed_length;
     }
 
@@ -184,7 +184,7 @@ public abstract class Select extends BranchInstruction implements VariableLength
      * @return the match_length
      * @since 6.0
      */
-    final int getMatch_length() {
+    final int getMatchLength() {
         return match_length;
     }
 
@@ -236,7 +236,7 @@ public abstract class Select extends BranchInstruction implements VariableLength
      * @param fixedLength the fixed_length to set
      * @since 6.0
      */
-    final void setFixed_length(final int fixedLength) {
+    final void setFixedLength(final int fixedLength) {
         this.fixed_length = fixedLength;
     }
 
@@ -269,7 +269,7 @@ public abstract class Select extends BranchInstruction implements VariableLength
      * @param matchLength the match_length to set
      * @since 6.0
      */
-    final int setMatch_length(final int matchLength) {
+    final int setMatchLength(final int matchLength) {
         this.match_length = matchLength;
         return matchLength;
     }
diff --git a/src/main/java/org/apache/bcel/generic/TABLESWITCH.java b/src/main/java/org/apache/bcel/generic/TABLESWITCH.java
index cd145894..f87e99d6 100644
--- a/src/main/java/org/apache/bcel/generic/TABLESWITCH.java
+++ b/src/main/java/org/apache/bcel/generic/TABLESWITCH.java
@@ -42,9 +42,9 @@ public class TABLESWITCH extends Select {
     public TABLESWITCH(final int[] match, final InstructionHandle[] targets, final InstructionHandle defaultTarget) {
         super(org.apache.bcel.Const.TABLESWITCH, match, targets, defaultTarget);
         /* Alignment remainder assumed 0 here, until dump time */
-        final short length = (short) (13 + getMatch_length() * 4);
+        final short length = (short) (13 + getMatchLength() * 4);
         super.setLength(length);
-        setFixed_length(length);
+        setFixedLength(length);
     }
 
     /**
@@ -70,12 +70,12 @@ public class TABLESWITCH extends Select {
     @Override
     public void dump(final DataOutputStream out) throws IOException {
         super.dump(out);
-        final int match_length = getMatch_length();
-        final int low = match_length > 0 ? super.getMatch(0) : 0;
+        final int matchLength = getMatchLength();
+        final int low = matchLength > 0 ? super.getMatch(0) : 0;
         out.writeInt(low);
-        final int high = match_length > 0 ? super.getMatch(match_length - 1) : 0;
+        final int high = matchLength > 0 ? super.getMatch(matchLength - 1) : 0;
         out.writeInt(high);
-        for (int i = 0; i < match_length; i++) {
+        for (int i = 0; i < matchLength; i++) {
             out.writeInt(setIndices(i, getTargetOffset(super.getTarget(i))));
         }
     }
@@ -89,9 +89,9 @@ public class TABLESWITCH extends Select {
         final int low = bytes.readInt();
         final int high = bytes.readInt();
         final int matchLength = high - low + 1;
-        setMatch_length(matchLength);
+        setMatchLength(matchLength);
         final short fixedLength = (short) (13 + matchLength * 4);
-        setFixed_length(fixedLength);
+        setFixedLength(fixedLength);
         super.setLength((short) (fixedLength + super.getPadding()));
         super.setMatches(new int[matchLength]);
         super.setIndices(new int[matchLength]);
diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
index 2a411cc9..4762b9c3 100644
--- a/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
+++ b/src/main/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
@@ -84,7 +84,7 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
      * A Visitor class that ensures the constant pool satisfies the static constraints. The visitXXX() methods throw
      * ClassConstraintException instances otherwise.
      *
-     * @see #constant_pool_entries_satisfy_static_constraints()
+     * @see #constantPoolEntriesSatisfyStaticConstraints()
      */
     private final class CPESSC_Visitor extends EmptyVisitor {
         private final Class<?> CONST_Class;
@@ -659,9 +659,9 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
                 if (outerIdx != 0) {
                     checkIndex(innerClasses, outerIdx, CONST_Class);
                 }
-                final int innername_idx = ic.getInnerNameIndex();
-                if (innername_idx != 0) {
-                    checkIndex(innerClasses, innername_idx, CONST_Utf8);
+                final int innernameIdx = ic.getInnerNameIndex();
+                if (innernameIdx != 0) {
+                    checkIndex(innerClasses, innernameIdx, CONST_Utf8);
                 }
                 int acc = ic.getInnerAccessFlags();
                 acc = acc & ~(Const.ACC_PUBLIC | Const.ACC_PRIVATE | Const.ACC_PROTECTED | Const.ACC_STATIC | Const.ACC_FINAL | Const.ACC_INTERFACE |
@@ -999,7 +999,7 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
      * A Visitor class that ensures the ConstantCP-subclassed entries of the constant pool are valid. <B>Precondition:
      * index-style cross referencing in the constant pool must be valid.</B>
      *
-     * @see #constant_pool_entries_satisfy_static_constraints()
+     * @see #constantPoolEntriesSatisfyStaticConstraints()
      * @see org.apache.bcel.classfile.ConstantCP
      */
     private final class FAMRAV_Visitor extends EmptyVisitor {
@@ -1261,7 +1261,7 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
      *
      * @throws ClassConstraintException otherwise.
      */
-    private void constant_pool_entries_satisfy_static_constraints() {
+    private void constantPoolEntriesSatisfyStaticConstraints() {
         try {
             // Most of the consistency is handled internally by BCEL; here
             // we only have to verify if the indices of the constants point
@@ -1300,10 +1300,10 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
 
                 VerificationResult vr = VerificationResult.VR_OK; // default.
                 try {
-                    constant_pool_entries_satisfy_static_constraints();
-                    field_and_method_refs_are_valid();
-                    every_class_has_an_accessible_superclass();
-                    final_methods_are_not_overridden();
+                    constantPoolEntriesSatisfyStaticConstraints();
+                    fieldAndMethodRefsAreValid();
+                    everyClassHasAnAccessibleSuperclass();
+                    finalMethodsAreNotOverridden();
                 } catch (final ClassConstraintException cce) {
                     vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, cce.getMessage());
                 }
@@ -1325,7 +1325,7 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
      *
      * @throws ClassConstraintException otherwise.
      */
-    private void every_class_has_an_accessible_superclass() {
+    private void everyClassHasAnAccessibleSuperclass() {
         try {
             final Set<String> hs = new HashSet<>(); // save class names to detect circular inheritance
             JavaClass jc = Repository.lookupClass(myOwner.getClassName());
@@ -1373,9 +1373,9 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
      * constant_pool_entries_satisfy_static_constraints() before.</B>
      *
      * @throws ClassConstraintException otherwise.
-     * @see #constant_pool_entries_satisfy_static_constraints()
+     * @see #constantPoolEntriesSatisfyStaticConstraints()
      */
-    private void field_and_method_refs_are_valid() {
+    private void fieldAndMethodRefsAreValid() {
         try {
             final JavaClass jc = Repository.lookupClass(myOwner.getClassName());
             final DescendingVisitor v = new DescendingVisitor(jc, new FAMRAV_Visitor(jc));
@@ -1393,10 +1393,10 @@ public final class Pass2Verifier extends PassVerifier implements Constants {
      * before (in that order).</B>
      *
      * @throws ClassConstraintException otherwise.
-     * @see #constant_pool_entries_satisfy_static_constraints()
-     * @see #every_class_has_an_accessible_superclass()
+     * @see #constantPoolEntriesSatisfyStaticConstraints()
+     * @see #everyClassHasAnAccessibleSuperclass()
      */
-    private void final_methods_are_not_overridden() {
+    private void finalMethodsAreNotOverridden() {
         try {
             final Map<String, String> hashmap = new HashMap<>();
             JavaClass jc = Repository.lookupClass(myOwner.getClassName());
diff --git a/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java b/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
index 6ba4ea2a..a066de4c 100644
--- a/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
+++ b/src/main/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
@@ -137,7 +137,7 @@ public final class Pass3aVerifier extends PassVerifier {
             for (final Method element : ms) {
                 if (element.getName().equals(invoke.getMethodName(constantPoolGen))
                     && Type.getReturnType(element.getSignature()).equals(invoke.getReturnType(constantPoolGen))
-                    && objarrayequals(Type.getArgumentTypes(element.getSignature()), invoke.getArgumentTypes(constantPoolGen))) {
+                    && objArrayEquals(Type.getArgumentTypes(element.getSignature()), invoke.getArgumentTypes(constantPoolGen))) {
                     return element;
                 }
             }
@@ -209,7 +209,7 @@ public final class Pass3aVerifier extends PassVerifier {
         /**
          * Utility method to return the max_locals value of the method verified by the surrounding Pass3aVerifier instance.
          */
-        private int max_locals() {
+        private int maxLocals() {
             try {
                 return Repository.lookupClass(myOwner.getClassName()).getMethods()[methodNo].getCode().getMaxLocals();
             } catch (final ClassNotFoundException e) {
@@ -222,7 +222,7 @@ public final class Pass3aVerifier extends PassVerifier {
          * A utility method like equals(Object) for arrays. The equality of the elements is based on their equals(Object) method
          * instead of their object identity.
          */
-        private boolean objarrayequals(final Object[] o, final Object[] p) {
+        private boolean objArrayEquals(final Object[] o, final Object[] p) {
             if (o.length != p.length) {
                 return false;
             }
@@ -243,7 +243,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -275,7 +275,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -300,7 +300,7 @@ public final class Pass3aVerifier extends PassVerifier {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative."
                     + " [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
             } else {
-                final int maxminus2 = max_locals() - 2;
+                final int maxminus2 = maxLocals() - 2;
                 if (idx > maxminus2) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-2 '" + maxminus2 + "'.");
                 }
@@ -315,7 +315,7 @@ public final class Pass3aVerifier extends PassVerifier {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative."
                     + " [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
             } else {
-                final int maxminus2 = max_locals() - 2;
+                final int maxminus2 = maxLocals() - 2;
                 if (idx > maxminus2) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-2 '" + maxminus2 + "'.");
                 }
@@ -403,7 +403,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -417,7 +417,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -458,7 +458,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -472,7 +472,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -623,7 +623,7 @@ public final class Pass3aVerifier extends PassVerifier {
                         for (final Method meth2 : meths) {
                             if (meth2.getName().equals(o.getMethodName(constantPoolGen))
                                 && Type.getReturnType(meth2.getSignature()).equals(o.getReturnType(constantPoolGen))
-                                && objarrayequals(Type.getArgumentTypes(meth2.getSignature()), o.getArgumentTypes(constantPoolGen))) {
+                                && objArrayEquals(Type.getArgumentTypes(meth2.getSignature()), o.getArgumentTypes(constantPoolGen))) {
                                 meth = meth2;
                                 break;
                             }
@@ -702,7 +702,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -747,7 +747,7 @@ public final class Pass3aVerifier extends PassVerifier {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative."
                     + " [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
             } else {
-                final int maxminus2 = max_locals() - 2;
+                final int maxminus2 = maxLocals() - 2;
                 if (idx > maxminus2) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-2 '" + maxminus2 + "'.");
                 }
@@ -808,7 +808,7 @@ public final class Pass3aVerifier extends PassVerifier {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative."
                     + " [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
             } else {
-                final int maxminus2 = max_locals() - 2;
+                final int maxminus2 = maxLocals() - 2;
                 if (idx > maxminus2) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-2 '" + maxminus2 + "'.");
                 }
@@ -913,7 +913,7 @@ public final class Pass3aVerifier extends PassVerifier {
             if (idx < 0) {
                 constraintViolated(o, "Index '" + idx + "' must be non-negative.");
             } else {
-                final int maxminus1 = max_locals() - 1;
+                final int maxminus1 = maxLocals() - 1;
                 if (idx > maxminus1) {
                     constraintViolated(o, "Index '" + idx + "' must not be greater than max_locals-1 '" + maxminus1 + "'.");
                 }
@@ -986,7 +986,7 @@ public final class Pass3aVerifier extends PassVerifier {
         if (lnt != null) {
             final LineNumber[] lineNumbers = lnt.getLineNumberTable();
             final IntList offsets = new IntList();
-            lineNumber_loop: for (final LineNumber lineNumber : lineNumbers) { // may appear in any order.
+            lineNumberLoop: for (final LineNumber lineNumber : lineNumbers) { // may appear in any order.
                 for (final int instructionPosition : instructionPositions) {
                     // TODO: Make this a binary search! The instructionPositions array is naturally ordered!
                     final int offset = lineNumber.getStartPC();
@@ -997,7 +997,7 @@ public final class Pass3aVerifier extends PassVerifier {
                         } else {
                             offsets.add(offset);
                         }
-                        continue lineNumber_loop;
+                        continue lineNumberLoop;
                     }
                 }
                 throw new ClassConstraintException("Code attribute '" + tostring(code) + "' has a LineNumberTable attribute '" + code.getLineNumberTable()
diff --git a/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java b/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
index 4461c663..57aaeb84 100644
--- a/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
+++ b/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
@@ -197,21 +197,21 @@ public final class Pass3bVerifier extends PassVerifier {
 
                 // Sanity check
                 InstructionContext lastJSR = null;
-                int skip_jsr = 0;
+                int skipJsr = 0;
                 for (int ss = oldchain.size() - 1; ss >= 0; ss--) {
-                    if (skip_jsr < 0) {
+                    if (skipJsr < 0) {
                         throw new AssertionViolatedException("More RET than JSR in execution chain?!");
                     }
 //System.err.println("+"+oldchain.get(ss));
                     if (oldchain.get(ss).getInstruction().getInstruction() instanceof JsrInstruction) {
-                        if (skip_jsr == 0) {
+                        if (skipJsr == 0) {
                             lastJSR = oldchain.get(ss);
                             break;
                         }
-                        skip_jsr--;
+                        skipJsr--;
                     }
                     if (oldchain.get(ss).getInstruction().getInstruction() instanceof RET) {
-                        skip_jsr++;
+                        skipJsr++;
                     }
                 }
                 if (lastJSR == null) {
diff --git a/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java b/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
index 6b137215..05cbbd73 100644
--- a/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
+++ b/src/test/java/org/apache/bcel/generic/GeneratingAnnotatedClassesTestCase.java
@@ -143,8 +143,8 @@ public class GeneratingAnnotatedClassesTestCase extends AbstractTestCase {
         final InstructionHandle tryEnd = il.append(g);
         // We add the exception handler which simply returns from the method.
         final LocalVariableGen varEx = mg.addLocalVariable("ex", Type.getType("Ljava.io.IOException;"), null, null);
-        final int var_ex_slot = varEx.getIndex();
-        final InstructionHandle handler = il.append(new ASTORE(var_ex_slot));
+        final int varExSlot = varEx.getIndex();
+        final InstructionHandle handler = il.append(new ASTORE(varExSlot));
         varEx.setStart(handler);
         varEx.setEnd(il.append(InstructionConst.RETURN));
         mg.addExceptionHandler(tryStart, tryEnd, handler, new ObjectType("java.io.IOException"));


[commons-bcel] 01/02: Use camel case for parameter names and local variable 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 31ab85a74e17f6fdf8977bb448ed3475c98d7446
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Oct 22 16:11:33 2022 -0400

    Use camel case for parameter names and local variable names
---
 src/main/java/org/apache/bcel/generic/Select.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/bcel/generic/Select.java b/src/main/java/org/apache/bcel/generic/Select.java
index 05d3c185..58c6671d 100644
--- a/src/main/java/org/apache/bcel/generic/Select.java
+++ b/src/main/java/org/apache/bcel/generic/Select.java
@@ -233,11 +233,11 @@ public abstract class Select extends BranchInstruction implements VariableLength
     }
 
     /**
-     * @param fixed_length the fixed_length to set
+     * @param fixedLength the fixed_length to set
      * @since 6.0
      */
-    final void setFixed_length(final int fixed_length) {
-        this.fixed_length = fixed_length;
+    final void setFixed_length(final int fixedLength) {
+        this.fixed_length = fixedLength;
     }
 
     /** @since 6.0 */