commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1661447 - /commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
Date Sat, 21 Feb 2015 22:45:02 GMT
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;



Mime
View raw message