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 16:02:36 UTC

[commons-bcel] 01/02: Use camel case for parameter names and local variable names

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 296c3873cca6b175fd19827dae2e05b13351fc57
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Sat Oct 22 12:00:05 2022 -0400

    Use camel case for parameter names and local variable names
---
 src/examples/HelloWorldBuilder.java |  6 +++---
 src/examples/JasminVisitor.java     | 16 ++++++++--------
 src/examples/helloify.java          |  4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/examples/HelloWorldBuilder.java b/src/examples/HelloWorldBuilder.java
index 44c46923..431561f2 100644
--- a/src/examples/HelloWorldBuilder.java
+++ b/src/examples/HelloWorldBuilder.java
@@ -98,7 +98,7 @@ public class HelloWorldBuilder {
         lg.setStart(il.append(new ASTORE(name))); // `name' valid from here
 
         // try { ...
-        final InstructionHandle try_start = il.append(factory.createFieldAccess("java.lang.System", "out", pStream, Const.GETSTATIC));
+        final InstructionHandle tryStart = il.append(factory.createFieldAccess("java.lang.System", "out", pStream, Const.GETSTATIC));
 
         il.append(new PUSH(cp, "Please enter your name> "));
         il.append(factory.createInvoke("java.io.PrintStream", "print", Type.VOID, new Type[] {Type.STRING}, Const.INVOKEVIRTUAL));
@@ -108,7 +108,7 @@ public class HelloWorldBuilder {
 
         // Upon normal execution we jump behind exception handler, the target address is not known yet.
         final GOTO g = new GOTO(null);
-        final InstructionHandle try_end = il.append(g);
+        final InstructionHandle tryEnd = il.append(g);
 
         /*
          * } catch() { ... } Add exception handler: print exception and return from method
@@ -119,7 +119,7 @@ public class HelloWorldBuilder {
 
         il.append(factory.createInvoke("java.io.PrintStream", "println", Type.VOID, new Type[] {Type.OBJECT}, Const.INVOKEVIRTUAL));
         il.append(InstructionConst.RETURN);
-        mg.addExceptionHandler(try_start, try_end, handler, new ObjectType("java.io.IOException"));
+        mg.addExceptionHandler(tryStart, tryEnd, handler, new ObjectType("java.io.IOException"));
 
         // Normal code continues, now we can set the branch target of the GOTO that jumps over the handler code.
         final InstructionHandle ih = il.append(factory.createFieldAccess("java.lang.System", "out", pStream, Const.GETSTATIC));
diff --git a/src/examples/JasminVisitor.java b/src/examples/JasminVisitor.java
index ce323e9c..66925ab0 100644
--- a/src/examples/JasminVisitor.java
+++ b/src/examples/JasminVisitor.java
@@ -143,7 +143,7 @@ public class JasminVisitor extends org.apache.bcel.classfile.EmptyVisitor {
 
     @Override
     public void visitCode(final Code code) {
-        int label_counter = 0;
+        int labelCounter = 0;
 
         out.println(".limit stack " + code.getMaxStack());
         out.println(".limit locals " + code.getMaxLocals());
@@ -163,32 +163,32 @@ public class JasminVisitor extends org.apache.bcel.classfile.EmptyVisitor {
 
                 if (bi instanceof Select) { // Special cases LOOKUPSWITCH and TABLESWITCH
                     for (final InstructionHandle target : ((Select) bi).getTargets()) {
-                        put(target, "Label" + label_counter++ + ":");
+                        put(target, "Label" + labelCounter++ + ":");
                     }
                 }
 
                 final InstructionHandle ih = bi.getTarget();
-                put(ih, "Label" + label_counter++ + ":");
+                put(ih, "Label" + labelCounter++ + ":");
             }
         }
 
         final LocalVariableGen[] lvs = mg.getLocalVariables();
         for (final LocalVariableGen lv : lvs) {
             InstructionHandle ih = lv.getStart();
-            put(ih, "Label" + label_counter++ + ":");
+            put(ih, "Label" + labelCounter++ + ":");
             ih = lv.getEnd();
-            put(ih, "Label" + label_counter++ + ":");
+            put(ih, "Label" + labelCounter++ + ":");
         }
 
         final CodeExceptionGen[] ehs = mg.getExceptionHandlers();
         for (final CodeExceptionGen c : ehs) {
             InstructionHandle ih = c.getStartPC();
 
-            put(ih, "Label" + label_counter++ + ":");
+            put(ih, "Label" + labelCounter++ + ":");
             ih = c.getEndPC();
-            put(ih, "Label" + label_counter++ + ":");
+            put(ih, "Label" + labelCounter++ + ":");
             ih = c.getHandlerPC();
-            put(ih, "Label" + label_counter++ + ":");
+            put(ih, "Label" + labelCounter++ + ":");
         }
 
         final LineNumberGen[] lns = mg.getLineNumbers();
diff --git a/src/examples/helloify.java b/src/examples/helloify.java
index 3fdf5579..26b6ae26 100644
--- a/src/examples/helloify.java
+++ b/src/examples/helloify.java
@@ -106,7 +106,7 @@ public final class helloify {
             if (arg.endsWith(".class")) {
                 final JavaClass javaClass = new ClassParser(arg).parse();
                 final ConstantPool constants = javaClass.getConstantPool();
-                final String file_name = arg.substring(0, arg.length() - 6) + "_hello.class";
+                final String fileName = arg.substring(0, arg.length() - 6) + "_hello.class";
                 cp = new ConstantPoolGen(constants);
 
                 helloifyClassName(javaClass);
@@ -122,7 +122,7 @@ public final class helloify {
 
                 // Finally dump it back to a file.
                 javaClass.setConstantPool(cp.getFinalConstantPool());
-                javaClass.dump(file_name);
+                javaClass.dump(fileName);
             }
         }
     }