commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1392547 - in /commons/sandbox/nabla/trunk: ./ src/main/java/org/apache/commons/nabla/forward/analysis/
Date Mon, 01 Oct 2012 19:31:20 GMT
Author: luc
Date: Mon Oct  1 19:31:20 2012
New Revision: 1392547

URL: http://svn.apache.org/viewvc?rev=1392547&view=rev
Log:
Use final keyword wherever possible.

Modified:
    commons/sandbox/nabla/trunk/checkstyle.xml
    commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/ClassDifferentiator.java
    commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/MethodDifferentiator.java
    commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/TrackingInterpreter.java

Modified: commons/sandbox/nabla/trunk/checkstyle.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/checkstyle.xml?rev=1392547&r1=1392546&r2=1392547&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/checkstyle.xml (original)
+++ commons/sandbox/nabla/trunk/checkstyle.xml Mon Oct  1 19:31:20 2012
@@ -134,6 +134,10 @@
       <property name="ignoreStringsRegexp" value='^(("")|(".")|("unchecked"))$'/>
     </module>
 
+    <!-- Use final wherever possible -->
+    <module name="FinalLocalVariable"/>
+    <module name="FinalParameters"/>
+    
     <!-- <module name="TodoComment" /> -->
 
   </module>

Modified: commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/ClassDifferentiator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/ClassDifferentiator.java?rev=1392547&r1=1392546&r2=1392547&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/ClassDifferentiator.java
(original)
+++ commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/ClassDifferentiator.java
Mon Oct  1 19:31:20 2012
@@ -198,8 +198,8 @@ public class ClassDifferentiator {
             new MethodNode(Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, "getPrimitiveField",
                            Type.getMethodDescriptor(Type.getType(Object.class), Type.getType(String.class)),
                            null, null);
-        Label start     = new Label();
-        Label end       = new Label();
+        final Label start     = new Label();
+        final Label end       = new Label();
         method.visitTryCatchBlock(start, end, end, Type.getInternalName(IllegalAccessException.class));
         method.visitTryCatchBlock(start, end, end, Type.getInternalName(NoSuchFieldException.class));
         method.visitLabel(start);

Modified: commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/MethodDifferentiator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/MethodDifferentiator.java?rev=1392547&r1=1392546&r2=1392547&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/MethodDifferentiator.java
(original)
+++ commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/MethodDifferentiator.java
Mon Oct  1 19:31:20 2012
@@ -315,9 +315,9 @@ public class MethodDifferentiator {
 
         // the various GETFIELD/PUTFIELD instructions must also be changed
         // to retrieve the field from the outer class
-        ListIterator<AbstractInsnNode> iterator = instructions.iterator();
+        final ListIterator<AbstractInsnNode> iterator = instructions.iterator();
         while (iterator.hasNext()) {
-            AbstractInsnNode ins = iterator.next();
+            final AbstractInsnNode ins = iterator.next();
             if ((ins.getOpcode() == Opcodes.GETFIELD) || (ins.getOpcode() == Opcodes.PUTFIELD))
{
                 changes.add(ins);
             }

Modified: commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/TrackingInterpreter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/TrackingInterpreter.java?rev=1392547&r1=1392546&r2=1392547&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/TrackingInterpreter.java
(original)
+++ commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/forward/analysis/TrackingInterpreter.java
Mon Oct  1 19:31:20 2012
@@ -117,7 +117,7 @@ public class TrackingInterpreter extends
             case Opcodes.SIPUSH:
                 return new TrackingValue(Type.INT_TYPE, insn);
             case Opcodes.LDC:
-                Object cst = ((LdcInsnNode) insn).cst;
+                final Object cst = ((LdcInsnNode) insn).cst;
                 if (cst instanceof Integer) {
                     return new TrackingValue(Type.INT_TYPE, insn);
                 } else if (cst instanceof Float) {
@@ -129,7 +129,7 @@ public class TrackingInterpreter extends
                 } else if (cst instanceof String) {
                     return new TrackingValue(Type.getType(String.class), insn);
                 } else if (cst instanceof Type) {
-                    int sort = ((Type) cst).getSort();
+                    final int sort = ((Type) cst).getSort();
                     if (sort == Type.OBJECT || sort == Type.ARRAY) {
                         return new TrackingValue(Type.getType(Class.class), insn);
                     } else if (sort == Type.METHOD) {
@@ -222,16 +222,18 @@ public class TrackingInterpreter extends
                     default:
                         throw new AnalyzerException(insn, "Invalid array type");
                 }
-            case Opcodes.ANEWARRAY:
-                String desc = ((TypeInsnNode) insn).desc;
+            case Opcodes.ANEWARRAY: {
+                final String desc = ((TypeInsnNode) insn).desc;
                 return new TrackingValue(Type.getType("[" + Type.getObjectType(desc)), insn);
+            }
             case Opcodes.ARRAYLENGTH:
                 return new TrackingValue(Type.INT_TYPE, insn);
             case Opcodes.ATHROW:
                 return null;
-            case Opcodes.CHECKCAST:
-                desc = ((TypeInsnNode) insn).desc;
+            case Opcodes.CHECKCAST: {
+                final String desc = ((TypeInsnNode) insn).desc;
                 return new TrackingValue(Type.getObjectType(desc), insn);
+            }
             case Opcodes.INSTANCEOF:
                 return new TrackingValue(Type.INT_TYPE, insn);
             case Opcodes.MONITORENTER:
@@ -334,7 +336,7 @@ public class TrackingInterpreter extends
         for (final Iterator<?> iterator = values.iterator(); iterator.hasNext();) {
             ((TrackingValue) iterator.next()).addConsumer(insn);
         }
-        int opcode = insn.getOpcode();
+        final int opcode = insn.getOpcode();
         if (opcode == Opcodes.MULTIANEWARRAY) {
             return new TrackingValue(Type.getType(((MultiANewArrayInsnNode) insn).desc),
insn);
         } else if (opcode == Opcodes.INVOKEDYNAMIC){
@@ -361,7 +363,8 @@ public class TrackingInterpreter extends
     }
 
     /** {@inheritDoc} */
-    public void returnOperation(AbstractInsnNode insn, TrackingValue value, TrackingValue
expected) {
+    public void returnOperation(final AbstractInsnNode insn,
+                                final TrackingValue value, final TrackingValue expected)
{
         // nothing to do here, as unaryOperation has already been called
     }
 



Mime
View raw message