You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2015/02/21 23:45:02 UTC

svn commit: r1661447 - /commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java

Author: ebourg
Date: Sat Feb 21 22:45:02 2015
New Revision: 1661447

URL: http://svn.apache.org/r1661447
Log:
Removed unnecessary casts in InstructionFactory

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java?rev=1661447&r1=1661446&r2=1661447&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java Sat Feb 21 22:45:02 2015
@@ -304,9 +304,7 @@ public class InstructionFactory implemen
             case '<':
                 return ISHL;
             case '>':
-                return op.equals(">>>")
-                        ? (ArithmeticInstruction) IUSHR
-                        : (ArithmeticInstruction) ISHR;
+                return op.equals(">>>") ? IUSHR : ISHR;
             default:
                 throw new RuntimeException("Invalid operand " + op);
         }
@@ -334,9 +332,7 @@ public class InstructionFactory implemen
             case '<':
                 return LSHL;
             case '>':
-                return op.equals(">>>")
-                        ? (ArithmeticInstruction) LUSHR
-                        : (ArithmeticInstruction) LSHR;
+                return op.equals(">>>") ? LUSHR : LSHR;
             default:
                 throw new RuntimeException("Invalid operand " + op);
         }
@@ -408,7 +404,7 @@ public class InstructionFactory implemen
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createPop( int size ) {
-        return (size == 2) ? (StackInstruction) POP2 : (StackInstruction) POP;
+        return (size == 2) ? POP2 : POP;
     }
 
 
@@ -416,7 +412,7 @@ public class InstructionFactory implemen
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createDup( int size ) {
-        return (size == 2) ? (StackInstruction) DUP2 : (StackInstruction) DUP;
+        return (size == 2) ? DUP2 : DUP;
     }
 
 
@@ -424,7 +420,7 @@ public class InstructionFactory implemen
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createDup_2( int size ) {
-        return (size == 2) ? (StackInstruction) DUP2_X2 : (StackInstruction) DUP_X2;
+        return (size == 2) ? DUP2_X2 : DUP_X2;
     }
 
 
@@ -432,7 +428,7 @@ public class InstructionFactory implemen
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createDup_1( int size ) {
-        return (size == 2) ? (StackInstruction) DUP2_X1 : (StackInstruction) DUP_X1;
+        return (size == 2) ? DUP2_X1 : DUP_X1;
     }
 
 
@@ -636,7 +632,7 @@ public class InstructionFactory implemen
             } else if (t instanceof ArrayType) {
                 return new ANEWARRAY(cp.addArrayClass((ArrayType) t));
             } else {
-                return new NEWARRAY(((BasicType) t).getType());
+                return new NEWARRAY(t.getType());
             }
         } else {
             ArrayType at;