commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1702352 - in /commons/proper/bcel/trunk/src: main/java/org/apache/commons/bcel6/generic/ main/java/org/apache/commons/bcel6/util/ test/java/org/apache/commons/bcel6/generic/ test/java/org/apache/commons/bcel6/verifier/tests/
Date Fri, 11 Sep 2015 00:01:17 GMT
Author: sebb
Date: Fri Sep 11 00:01:16 2015
New Revision: 1702352

URL: http://svn.apache.org/r1702352
Log:
Gradually working towards restoring binary compatibility
Revert InstructionConstants back to interface

Added:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConst.java   (with props)
Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConstants.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUSH.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELFactory.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/GeneratingAnnotatedClassesTestCase.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java Fri Sep 11 00:01:16 2015
@@ -297,9 +297,9 @@ public class ClassGen extends AccessFlag
      */
     public void addEmptyConstructor( int access_flags ) {
         InstructionList il = new InstructionList();
-        il.append(InstructionConstants.THIS); // Push `this'
+        il.append(InstructionConst.THIS); // Push `this'
         il.append(new INVOKESPECIAL(cp.addMethodref(super_class_name, "<init>", "()V")));
-        il.append(InstructionConstants.RETURN);
+        il.append(InstructionConst.RETURN);
         MethodGen mg = new MethodGen(access_flags, Type.VOID, Type.NO_ARGS, null, "<init>",
                 class_name, il, cp);
         mg.setMaxStack(1);

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java Fri Sep 11 00:01:16 2015
@@ -121,7 +121,7 @@ public abstract class Instruction implem
     public Instruction copy() {
         Instruction i = null;
         // "Constant" instruction, no need to duplicate
-        if (InstructionConstants.getInstruction(this.getOpcode()) != null) {
+        if (InstructionConst.getInstruction(this.getOpcode()) != null) {
             i = this;
         } else {
             try {
@@ -149,11 +149,11 @@ public abstract class Instruction implem
      * Read an instruction from (byte code) input stream and return the
      * appropiate object.
      * <p>
-     * If the Instruction is defined in {@link InstructionConstants}, then the
+     * If the Instruction is defined in {@link InstructionConst}, then the
      * singleton instance is returned.
      * @param bytes input stream bytes
      * @return instruction object being read
-     * @see InstructionConstants#getInstruction(int)
+     * @see InstructionConst#getInstruction(int)
      */
     // @since 6.0 no longer final
     public static Instruction readInstruction( ByteSequence bytes ) throws IOException {
@@ -164,7 +164,7 @@ public abstract class Instruction implem
             wide = true;
             opcode = (short) bytes.readUnsignedByte();
         }
-        final Instruction instruction = InstructionConstants.getInstruction(opcode);
+        final Instruction instruction = InstructionConst.getInstruction(opcode);
         if (instruction != null) {
             return instruction; // Used predefined immutable object, if available
         }

Added: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConst.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConst.java?rev=1702352&view=auto
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConst.java (added)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConst.java Fri Sep 11 00:01:16 2015
@@ -0,0 +1,297 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.commons.bcel6.generic;
+
+import org.apache.commons.bcel6.Constants;
+
+/** 
+ * This interface contains shareable instruction objects.
+ *
+ * In order to save memory you can use some instructions multiply,
+ * since they have an immutable state and are directly derived from
+ * Instruction.  I.e. they have no instance fields that could be
+ * changed. Since some of these instructions like ICONST_0 occur
+ * very frequently this can save a lot of time and space. This
+ * feature is an adaptation of the FlyWeight design pattern, we
+ * just use an array instead of a factory.
+ *
+ * The Instructions can also accessed directly under their names, so
+ * it's possible to write il.append(Instruction.ICONST_0);
+ *
+ * @version $Id: InstructionConstants.java 1695415 2015-08-12 01:02:39Z chas $
+ */
+public final class InstructionConst {
+
+    /** 
+     * Predefined instruction objects
+     */
+    /*
+     * NOTE these are not currently immutable, because Instruction
+     * has mutable protected fields opcode and length.
+     */
+    public static final Instruction NOP = new NOP();
+    public static final Instruction ACONST_NULL = new ACONST_NULL();
+    public static final Instruction ICONST_M1 = new ICONST(-1);
+    public static final Instruction ICONST_0 = new ICONST(0);
+    public static final Instruction ICONST_1 = new ICONST(1);
+    public static final Instruction ICONST_2 = new ICONST(2);
+    public static final Instruction ICONST_3 = new ICONST(3);
+    public static final Instruction ICONST_4 = new ICONST(4);
+    public static final Instruction ICONST_5 = new ICONST(5);
+    public static final Instruction LCONST_0 = new LCONST(0);
+    public static final Instruction LCONST_1 = new LCONST(1);
+    public static final Instruction FCONST_0 = new FCONST(0);
+    public static final Instruction FCONST_1 = new FCONST(1);
+    public static final Instruction FCONST_2 = new FCONST(2);
+    public static final Instruction DCONST_0 = new DCONST(0);
+    public static final Instruction DCONST_1 = new DCONST(1);
+    public static final ArrayInstruction IALOAD = new IALOAD();
+    public static final ArrayInstruction LALOAD = new LALOAD();
+    public static final ArrayInstruction FALOAD = new FALOAD();
+    public static final ArrayInstruction DALOAD = new DALOAD();
+    public static final ArrayInstruction AALOAD = new AALOAD();
+    public static final ArrayInstruction BALOAD = new BALOAD();
+    public static final ArrayInstruction CALOAD = new CALOAD();
+    public static final ArrayInstruction SALOAD = new SALOAD();
+    public static final ArrayInstruction IASTORE = new IASTORE();
+    public static final ArrayInstruction LASTORE = new LASTORE();
+    public static final ArrayInstruction FASTORE = new FASTORE();
+    public static final ArrayInstruction DASTORE = new DASTORE();
+    public static final ArrayInstruction AASTORE = new AASTORE();
+    public static final ArrayInstruction BASTORE = new BASTORE();
+    public static final ArrayInstruction CASTORE = new CASTORE();
+    public static final ArrayInstruction SASTORE = new SASTORE();
+    public static final StackInstruction POP = new POP();
+    public static final StackInstruction POP2 = new POP2();
+    public static final StackInstruction DUP = new DUP();
+    public static final StackInstruction DUP_X1 = new DUP_X1();
+    public static final StackInstruction DUP_X2 = new DUP_X2();
+    public static final StackInstruction DUP2 = new DUP2();
+    public static final StackInstruction DUP2_X1 = new DUP2_X1();
+    public static final StackInstruction DUP2_X2 = new DUP2_X2();
+    public static final StackInstruction SWAP = new SWAP();
+    public static final ArithmeticInstruction IADD = new IADD();
+    public static final ArithmeticInstruction LADD = new LADD();
+    public static final ArithmeticInstruction FADD = new FADD();
+    public static final ArithmeticInstruction DADD = new DADD();
+    public static final ArithmeticInstruction ISUB = new ISUB();
+    public static final ArithmeticInstruction LSUB = new LSUB();
+    public static final ArithmeticInstruction FSUB = new FSUB();
+    public static final ArithmeticInstruction DSUB = new DSUB();
+    public static final ArithmeticInstruction IMUL = new IMUL();
+    public static final ArithmeticInstruction LMUL = new LMUL();
+    public static final ArithmeticInstruction FMUL = new FMUL();
+    public static final ArithmeticInstruction DMUL = new DMUL();
+    public static final ArithmeticInstruction IDIV = new IDIV();
+    public static final ArithmeticInstruction LDIV = new LDIV();
+    public static final ArithmeticInstruction FDIV = new FDIV();
+    public static final ArithmeticInstruction DDIV = new DDIV();
+    public static final ArithmeticInstruction IREM = new IREM();
+    public static final ArithmeticInstruction LREM = new LREM();
+    public static final ArithmeticInstruction FREM = new FREM();
+    public static final ArithmeticInstruction DREM = new DREM();
+    public static final ArithmeticInstruction INEG = new INEG();
+    public static final ArithmeticInstruction LNEG = new LNEG();
+    public static final ArithmeticInstruction FNEG = new FNEG();
+    public static final ArithmeticInstruction DNEG = new DNEG();
+    public static final ArithmeticInstruction ISHL = new ISHL();
+    public static final ArithmeticInstruction LSHL = new LSHL();
+    public static final ArithmeticInstruction ISHR = new ISHR();
+    public static final ArithmeticInstruction LSHR = new LSHR();
+    public static final ArithmeticInstruction IUSHR = new IUSHR();
+    public static final ArithmeticInstruction LUSHR = new LUSHR();
+    public static final ArithmeticInstruction IAND = new IAND();
+    public static final ArithmeticInstruction LAND = new LAND();
+    public static final ArithmeticInstruction IOR = new IOR();
+    public static final ArithmeticInstruction LOR = new LOR();
+    public static final ArithmeticInstruction IXOR = new IXOR();
+    public static final ArithmeticInstruction LXOR = new LXOR();
+    public static final ConversionInstruction I2L = new I2L();
+    public static final ConversionInstruction I2F = new I2F();
+    public static final ConversionInstruction I2D = new I2D();
+    public static final ConversionInstruction L2I = new L2I();
+    public static final ConversionInstruction L2F = new L2F();
+    public static final ConversionInstruction L2D = new L2D();
+    public static final ConversionInstruction F2I = new F2I();
+    public static final ConversionInstruction F2L = new F2L();
+    public static final ConversionInstruction F2D = new F2D();
+    public static final ConversionInstruction D2I = new D2I();
+    public static final ConversionInstruction D2L = new D2L();
+    public static final ConversionInstruction D2F = new D2F();
+    public static final ConversionInstruction I2B = new I2B();
+    public static final ConversionInstruction I2C = new I2C();
+    public static final ConversionInstruction I2S = new I2S();
+    public static final Instruction LCMP = new LCMP();
+    public static final Instruction FCMPL = new FCMPL();
+    public static final Instruction FCMPG = new FCMPG();
+    public static final Instruction DCMPL = new DCMPL();
+    public static final Instruction DCMPG = new DCMPG();
+    public static final ReturnInstruction IRETURN = new IRETURN();
+    public static final ReturnInstruction LRETURN = new LRETURN();
+    public static final ReturnInstruction FRETURN = new FRETURN();
+    public static final ReturnInstruction DRETURN = new DRETURN();
+    public static final ReturnInstruction ARETURN = new ARETURN();
+    public static final ReturnInstruction RETURN = new RETURN();
+    public static final Instruction ARRAYLENGTH = new ARRAYLENGTH();
+    public static final Instruction ATHROW = new ATHROW();
+    public static final Instruction MONITORENTER = new MONITORENTER();
+    public static final Instruction MONITOREXIT = new MONITOREXIT();
+
+    /** You can use these constants in multiple places safely, if you can guarantee
+     * that you will never alter their internal values, e.g. call setIndex().
+     */
+    public static final LocalVariableInstruction THIS = new ALOAD(0);
+    public static final LocalVariableInstruction ALOAD_0 = THIS;
+    public static final LocalVariableInstruction ALOAD_1 = new ALOAD(1);
+    public static final LocalVariableInstruction ALOAD_2 = new ALOAD(2);
+    public static final LocalVariableInstruction ILOAD_0 = new ILOAD(0);
+    public static final LocalVariableInstruction ILOAD_1 = new ILOAD(1);
+    public static final LocalVariableInstruction ILOAD_2 = new ILOAD(2);
+    public static final LocalVariableInstruction ASTORE_0 = new ASTORE(0);
+    public static final LocalVariableInstruction ASTORE_1 = new ASTORE(1);
+    public static final LocalVariableInstruction ASTORE_2 = new ASTORE(2);
+    public static final LocalVariableInstruction ISTORE_0 = new ISTORE(0);
+    public static final LocalVariableInstruction ISTORE_1 = new ISTORE(1);
+    public static final LocalVariableInstruction ISTORE_2 = new ISTORE(2);
+
+    /** Get object via its opcode, for immutable instructions like
+     * branch instructions entries are set to null.
+     */
+    private static final Instruction[] INSTRUCTIONS = new Instruction[256];
+
+    static {
+        INSTRUCTIONS[Constants.NOP] = NOP;
+        INSTRUCTIONS[Constants.ACONST_NULL] = ACONST_NULL;
+        INSTRUCTIONS[Constants.ICONST_M1] = ICONST_M1;
+        INSTRUCTIONS[Constants.ICONST_0] = ICONST_0;
+        INSTRUCTIONS[Constants.ICONST_1] = ICONST_1;
+        INSTRUCTIONS[Constants.ICONST_2] = ICONST_2;
+        INSTRUCTIONS[Constants.ICONST_3] = ICONST_3;
+        INSTRUCTIONS[Constants.ICONST_4] = ICONST_4;
+        INSTRUCTIONS[Constants.ICONST_5] = ICONST_5;
+        INSTRUCTIONS[Constants.LCONST_0] = LCONST_0;
+        INSTRUCTIONS[Constants.LCONST_1] = LCONST_1;
+        INSTRUCTIONS[Constants.FCONST_0] = FCONST_0;
+        INSTRUCTIONS[Constants.FCONST_1] = FCONST_1;
+        INSTRUCTIONS[Constants.FCONST_2] = FCONST_2;
+        INSTRUCTIONS[Constants.DCONST_0] = DCONST_0;
+        INSTRUCTIONS[Constants.DCONST_1] = DCONST_1;
+        INSTRUCTIONS[Constants.IALOAD] = IALOAD;
+        INSTRUCTIONS[Constants.LALOAD] = LALOAD;
+        INSTRUCTIONS[Constants.FALOAD] = FALOAD;
+        INSTRUCTIONS[Constants.DALOAD] = DALOAD;
+        INSTRUCTIONS[Constants.AALOAD] = AALOAD;
+        INSTRUCTIONS[Constants.BALOAD] = BALOAD;
+        INSTRUCTIONS[Constants.CALOAD] = CALOAD;
+        INSTRUCTIONS[Constants.SALOAD] = SALOAD;
+        INSTRUCTIONS[Constants.IASTORE] = IASTORE;
+        INSTRUCTIONS[Constants.LASTORE] = LASTORE;
+        INSTRUCTIONS[Constants.FASTORE] = FASTORE;
+        INSTRUCTIONS[Constants.DASTORE] = DASTORE;
+        INSTRUCTIONS[Constants.AASTORE] = AASTORE;
+        INSTRUCTIONS[Constants.BASTORE] = BASTORE;
+        INSTRUCTIONS[Constants.CASTORE] = CASTORE;
+        INSTRUCTIONS[Constants.SASTORE] = SASTORE;
+        INSTRUCTIONS[Constants.POP] = POP;
+        INSTRUCTIONS[Constants.POP2] = POP2;
+        INSTRUCTIONS[Constants.DUP] = DUP;
+        INSTRUCTIONS[Constants.DUP_X1] = DUP_X1;
+        INSTRUCTIONS[Constants.DUP_X2] = DUP_X2;
+        INSTRUCTIONS[Constants.DUP2] = DUP2;
+        INSTRUCTIONS[Constants.DUP2_X1] = DUP2_X1;
+        INSTRUCTIONS[Constants.DUP2_X2] = DUP2_X2;
+        INSTRUCTIONS[Constants.SWAP] = SWAP;
+        INSTRUCTIONS[Constants.IADD] = IADD;
+        INSTRUCTIONS[Constants.LADD] = LADD;
+        INSTRUCTIONS[Constants.FADD] = FADD;
+        INSTRUCTIONS[Constants.DADD] = DADD;
+        INSTRUCTIONS[Constants.ISUB] = ISUB;
+        INSTRUCTIONS[Constants.LSUB] = LSUB;
+        INSTRUCTIONS[Constants.FSUB] = FSUB;
+        INSTRUCTIONS[Constants.DSUB] = DSUB;
+        INSTRUCTIONS[Constants.IMUL] = IMUL;
+        INSTRUCTIONS[Constants.LMUL] = LMUL;
+        INSTRUCTIONS[Constants.FMUL] = FMUL;
+        INSTRUCTIONS[Constants.DMUL] = DMUL;
+        INSTRUCTIONS[Constants.IDIV] = IDIV;
+        INSTRUCTIONS[Constants.LDIV] = LDIV;
+        INSTRUCTIONS[Constants.FDIV] = FDIV;
+        INSTRUCTIONS[Constants.DDIV] = DDIV;
+        INSTRUCTIONS[Constants.IREM] = IREM;
+        INSTRUCTIONS[Constants.LREM] = LREM;
+        INSTRUCTIONS[Constants.FREM] = FREM;
+        INSTRUCTIONS[Constants.DREM] = DREM;
+        INSTRUCTIONS[Constants.INEG] = INEG;
+        INSTRUCTIONS[Constants.LNEG] = LNEG;
+        INSTRUCTIONS[Constants.FNEG] = FNEG;
+        INSTRUCTIONS[Constants.DNEG] = DNEG;
+        INSTRUCTIONS[Constants.ISHL] = ISHL;
+        INSTRUCTIONS[Constants.LSHL] = LSHL;
+        INSTRUCTIONS[Constants.ISHR] = ISHR;
+        INSTRUCTIONS[Constants.LSHR] = LSHR;
+        INSTRUCTIONS[Constants.IUSHR] = IUSHR;
+        INSTRUCTIONS[Constants.LUSHR] = LUSHR;
+        INSTRUCTIONS[Constants.IAND] = IAND;
+        INSTRUCTIONS[Constants.LAND] = LAND;
+        INSTRUCTIONS[Constants.IOR] = IOR;
+        INSTRUCTIONS[Constants.LOR] = LOR;
+        INSTRUCTIONS[Constants.IXOR] = IXOR;
+        INSTRUCTIONS[Constants.LXOR] = LXOR;
+        INSTRUCTIONS[Constants.I2L] = I2L;
+        INSTRUCTIONS[Constants.I2F] = I2F;
+        INSTRUCTIONS[Constants.I2D] = I2D;
+        INSTRUCTIONS[Constants.L2I] = L2I;
+        INSTRUCTIONS[Constants.L2F] = L2F;
+        INSTRUCTIONS[Constants.L2D] = L2D;
+        INSTRUCTIONS[Constants.F2I] = F2I;
+        INSTRUCTIONS[Constants.F2L] = F2L;
+        INSTRUCTIONS[Constants.F2D] = F2D;
+        INSTRUCTIONS[Constants.D2I] = D2I;
+        INSTRUCTIONS[Constants.D2L] = D2L;
+        INSTRUCTIONS[Constants.D2F] = D2F;
+        INSTRUCTIONS[Constants.I2B] = I2B;
+        INSTRUCTIONS[Constants.I2C] = I2C;
+        INSTRUCTIONS[Constants.I2S] = I2S;
+        INSTRUCTIONS[Constants.LCMP] = LCMP;
+        INSTRUCTIONS[Constants.FCMPL] = FCMPL;
+        INSTRUCTIONS[Constants.FCMPG] = FCMPG;
+        INSTRUCTIONS[Constants.DCMPL] = DCMPL;
+        INSTRUCTIONS[Constants.DCMPG] = DCMPG;
+        INSTRUCTIONS[Constants.IRETURN] = IRETURN;
+        INSTRUCTIONS[Constants.LRETURN] = LRETURN;
+        INSTRUCTIONS[Constants.FRETURN] = FRETURN;
+        INSTRUCTIONS[Constants.DRETURN] = DRETURN;
+        INSTRUCTIONS[Constants.ARETURN] = ARETURN;
+        INSTRUCTIONS[Constants.RETURN] = RETURN;
+        INSTRUCTIONS[Constants.ARRAYLENGTH] = ARRAYLENGTH;
+        INSTRUCTIONS[Constants.ATHROW] = ATHROW;
+        INSTRUCTIONS[Constants.MONITORENTER] = MONITORENTER;
+        INSTRUCTIONS[Constants.MONITOREXIT] = MONITOREXIT;
+    }
+
+    private InstructionConst() { } // non-instantiable 
+
+    /**
+     * Gets the Instruction.
+     * @param index the index, e.g. {@link Constants#RETURN}
+     * @return the entry from the private INSTRUCTIONS table
+     */
+    public static Instruction getInstruction(int index) {
+        return INSTRUCTIONS[index];
+    }
+}

Propchange: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConst.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConstants.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConstants.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionConstants.java Fri Sep 11 00:01:16 2015
@@ -34,8 +34,10 @@ import org.apache.commons.bcel6.Constant
  * it's possible to write il.append(Instruction.ICONST_0);
  *
  * @version $Id$
+ * @deprecated Do not use. Use InstructionConst instead.
  */
-public class InstructionConstants {
+@Deprecated
+public interface InstructionConstants {
 
     /** Predefined instruction objects
      */
@@ -169,9 +171,15 @@ public class InstructionConstants {
     /** Get object via its opcode, for immutable instructions like
      * branch instructions entries are set to null.
      */
-    private static final Instruction[] INSTRUCTIONS = new Instruction[256];
+    public static final Instruction[] INSTRUCTIONS = new Instruction[256];
+    /** Interfaces may have no static initializers, so we simulate this
+     * with an inner class.
+     */
+    static final Clinit bla = new Clinit();
+
+    static class Clinit {
 
-    static {
+        Clinit() {
             INSTRUCTIONS[Constants.NOP] = NOP;
             INSTRUCTIONS[Constants.ACONST_NULL] = ACONST_NULL;
             INSTRUCTIONS[Constants.ICONST_M1] = ICONST_M1;
@@ -279,16 +287,6 @@ public class InstructionConstants {
             INSTRUCTIONS[Constants.ATHROW] = ATHROW;
             INSTRUCTIONS[Constants.MONITORENTER] = MONITORENTER;
             INSTRUCTIONS[Constants.MONITOREXIT] = MONITOREXIT;
-    }
-
-    private InstructionConstants() { } // non-instantiable 
-
-    /**
-     * Gets the Instruction.
-     * @param index the index, e.g. {@link Constants#RETURN}
-     * @return the entry from the private INSTRUCTIONS table
-     */
-    public static Instruction getInstruction(int index) {
-        return INSTRUCTIONS[index];
+        }
     }
 }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/InstructionFactory.java Fri Sep 11 00:01:16 2015
@@ -26,11 +26,11 @@ import org.apache.commons.bcel6.Constant
  * add your own create methods.
  * <p>
  * Note: The static createXXX methods return singleton instances
- * from the {@link InstructionConstants} class.
+ * from the {@link InstructionConst} class.
  *
  * @version $Id$
  * @see Constants
- * @see InstructionConstants
+ * @see InstructionConst
  */
 public class InstructionFactory {
 
@@ -299,21 +299,21 @@ public class InstructionFactory {
         switch (type.getType()) {
             case Constants.T_ARRAY:
             case Constants.T_OBJECT:
-                return InstructionConstants.ARETURN;
+                return InstructionConst.ARETURN;
             case Constants.T_INT:
             case Constants.T_SHORT:
             case Constants.T_BOOLEAN:
             case Constants.T_CHAR:
             case Constants.T_BYTE:
-                return InstructionConstants.IRETURN;
+                return InstructionConst.IRETURN;
             case Constants.T_FLOAT:
-                return InstructionConstants.FRETURN;
+                return InstructionConst.FRETURN;
             case Constants.T_DOUBLE:
-                return InstructionConstants.DRETURN;
+                return InstructionConst.DRETURN;
             case Constants.T_LONG:
-                return InstructionConstants.LRETURN;
+                return InstructionConst.LRETURN;
             case Constants.T_VOID:
-                return InstructionConstants.RETURN;
+                return InstructionConst.RETURN;
             default:
                 throw new RuntimeException("Invalid type: " + type);
         }
@@ -323,25 +323,25 @@ public class InstructionFactory {
     private static ArithmeticInstruction createBinaryIntOp( char first, String op ) {
         switch (first) {
             case '-':
-                return InstructionConstants.ISUB;
+                return InstructionConst.ISUB;
             case '+':
-                return InstructionConstants.IADD;
+                return InstructionConst.IADD;
             case '%':
-                return InstructionConstants.IREM;
+                return InstructionConst.IREM;
             case '*':
-                return InstructionConstants.IMUL;
+                return InstructionConst.IMUL;
             case '/':
-                return InstructionConstants.IDIV;
+                return InstructionConst.IDIV;
             case '&':
-                return InstructionConstants.IAND;
+                return InstructionConst.IAND;
             case '|':
-                return InstructionConstants.IOR;
+                return InstructionConst.IOR;
             case '^':
-                return InstructionConstants.IXOR;
+                return InstructionConst.IXOR;
             case '<':
-                return InstructionConstants.ISHL;
+                return InstructionConst.ISHL;
             case '>':
-                return op.equals(">>>") ? InstructionConstants.IUSHR : InstructionConstants.ISHR;
+                return op.equals(">>>") ? InstructionConst.IUSHR : InstructionConst.ISHR;
             default:
                 throw new RuntimeException("Invalid operand " + op);
         }
@@ -351,25 +351,25 @@ public class InstructionFactory {
     private static ArithmeticInstruction createBinaryLongOp( char first, String op ) {
         switch (first) {
             case '-':
-                return InstructionConstants.LSUB;
+                return InstructionConst.LSUB;
             case '+':
-                return InstructionConstants.LADD;
+                return InstructionConst.LADD;
             case '%':
-                return InstructionConstants.LREM;
+                return InstructionConst.LREM;
             case '*':
-                return InstructionConstants.LMUL;
+                return InstructionConst.LMUL;
             case '/':
-                return InstructionConstants.LDIV;
+                return InstructionConst.LDIV;
             case '&':
-                return InstructionConstants.LAND;
+                return InstructionConst.LAND;
             case '|':
-                return InstructionConstants.LOR;
+                return InstructionConst.LOR;
             case '^':
-                return InstructionConstants.LXOR;
+                return InstructionConst.LXOR;
             case '<':
-                return InstructionConstants.LSHL;
+                return InstructionConst.LSHL;
             case '>':
-                return op.equals(">>>") ? InstructionConstants.LUSHR : InstructionConstants.LSHR;
+                return op.equals(">>>") ? InstructionConst.LUSHR : InstructionConst.LSHR;
             default:
                 throw new RuntimeException("Invalid operand " + op);
         }
@@ -379,15 +379,15 @@ public class InstructionFactory {
     private static ArithmeticInstruction createBinaryFloatOp( char op ) {
         switch (op) {
             case '-':
-                return InstructionConstants.FSUB;
+                return InstructionConst.FSUB;
             case '+':
-                return InstructionConstants.FADD;
+                return InstructionConst.FADD;
             case '*':
-                return InstructionConstants.FMUL;
+                return InstructionConst.FMUL;
             case '/':
-                return InstructionConstants.FDIV;
+                return InstructionConst.FDIV;
             case '%':
-                return InstructionConstants.FREM;
+                return InstructionConst.FREM;
             default:
                 throw new RuntimeException("Invalid operand " + op);
         }
@@ -397,15 +397,15 @@ public class InstructionFactory {
     private static ArithmeticInstruction createBinaryDoubleOp( char op ) {
         switch (op) {
             case '-':
-                return InstructionConstants.DSUB;
+                return InstructionConst.DSUB;
             case '+':
-                return InstructionConstants.DADD;
+                return InstructionConst.DADD;
             case '*':
-                return InstructionConstants.DMUL;
+                return InstructionConst.DMUL;
             case '/':
-                return InstructionConstants.DDIV;
+                return InstructionConst.DDIV;
             case '%':
-                return InstructionConstants.DREM;
+                return InstructionConst.DREM;
             default:
                 throw new RuntimeException("Invalid operand " + op);
         }
@@ -441,7 +441,7 @@ public class InstructionFactory {
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createPop( int size ) {
-        return (size == 2) ? InstructionConstants.POP2 : InstructionConstants.POP;
+        return (size == 2) ? InstructionConst.POP2 : InstructionConst.POP;
     }
 
 
@@ -449,7 +449,7 @@ public class InstructionFactory {
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createDup( int size ) {
-        return (size == 2) ? InstructionConstants.DUP2 : InstructionConstants.DUP;
+        return (size == 2) ? InstructionConst.DUP2 : InstructionConst.DUP;
     }
 
 
@@ -457,7 +457,7 @@ public class InstructionFactory {
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createDup_2( int size ) {
-        return (size == 2) ? InstructionConstants.DUP2_X2 : InstructionConstants.DUP_X2;
+        return (size == 2) ? InstructionConst.DUP2_X2 : InstructionConst.DUP_X2;
     }
 
 
@@ -465,7 +465,7 @@ public class InstructionFactory {
      * @param size size of operand, either 1 (int, e.g.) or 2 (double)
      */
     public static StackInstruction createDup_1( int size ) {
-        return (size == 2) ? InstructionConstants.DUP2_X1 : InstructionConstants.DUP_X1;
+        return (size == 2) ? InstructionConst.DUP2_X1 : InstructionConst.DUP_X1;
     }
 
 
@@ -528,22 +528,22 @@ public class InstructionFactory {
         switch (type.getType()) {
             case Constants.T_BOOLEAN:
             case Constants.T_BYTE:
-                return InstructionConstants.BALOAD;
+                return InstructionConst.BALOAD;
             case Constants.T_CHAR:
-                return InstructionConstants.CALOAD;
+                return InstructionConst.CALOAD;
             case Constants.T_SHORT:
-                return InstructionConstants.SALOAD;
+                return InstructionConst.SALOAD;
             case Constants.T_INT:
-                return InstructionConstants.IALOAD;
+                return InstructionConst.IALOAD;
             case Constants.T_FLOAT:
-                return InstructionConstants.FALOAD;
+                return InstructionConst.FALOAD;
             case Constants.T_DOUBLE:
-                return InstructionConstants.DALOAD;
+                return InstructionConst.DALOAD;
             case Constants.T_LONG:
-                return InstructionConstants.LALOAD;
+                return InstructionConst.LALOAD;
             case Constants.T_ARRAY:
             case Constants.T_OBJECT:
-                return InstructionConstants.AALOAD;
+                return InstructionConst.AALOAD;
             default:
                 throw new RuntimeException("Invalid type " + type);
         }
@@ -557,22 +557,22 @@ public class InstructionFactory {
         switch (type.getType()) {
             case Constants.T_BOOLEAN:
             case Constants.T_BYTE:
-                return InstructionConstants.BASTORE;
+                return InstructionConst.BASTORE;
             case Constants.T_CHAR:
-                return InstructionConstants.CASTORE;
+                return InstructionConst.CASTORE;
             case Constants.T_SHORT:
-                return InstructionConstants.SASTORE;
+                return InstructionConst.SASTORE;
             case Constants.T_INT:
-                return InstructionConstants.IASTORE;
+                return InstructionConst.IASTORE;
             case Constants.T_FLOAT:
-                return InstructionConstants.FASTORE;
+                return InstructionConst.FASTORE;
             case Constants.T_DOUBLE:
-                return InstructionConstants.DASTORE;
+                return InstructionConst.DASTORE;
             case Constants.T_LONG:
-                return InstructionConstants.LASTORE;
+                return InstructionConst.LASTORE;
             case Constants.T_ARRAY:
             case Constants.T_OBJECT:
-                return InstructionConstants.AASTORE;
+                return InstructionConst.AASTORE;
             default:
                 throw new RuntimeException("Invalid type " + type);
         }
@@ -685,21 +685,21 @@ public class InstructionFactory {
         switch (type.getType()) {
             case Constants.T_ARRAY:
             case Constants.T_OBJECT:
-                return InstructionConstants.ACONST_NULL;
+                return InstructionConst.ACONST_NULL;
             case Constants.T_INT:
             case Constants.T_SHORT:
             case Constants.T_BOOLEAN:
             case Constants.T_CHAR:
             case Constants.T_BYTE:
-                return InstructionConstants.ICONST_0;
+                return InstructionConst.ICONST_0;
             case Constants.T_FLOAT:
-                return InstructionConstants.FCONST_0;
+                return InstructionConst.FCONST_0;
             case Constants.T_DOUBLE:
-                return InstructionConstants.DCONST_0;
+                return InstructionConst.DCONST_0;
             case Constants.T_LONG:
-                return InstructionConstants.LCONST_0;
+                return InstructionConst.LCONST_0;
             case Constants.T_VOID:
-                return InstructionConstants.NOP;
+                return InstructionConst.NOP;
             default:
                 throw new RuntimeException("Invalid type: " + type);
         }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUSH.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUSH.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUSH.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUSH.java Fri Sep 11 00:01:16 2015
@@ -38,7 +38,7 @@ public final class PUSH implements Compo
      */
     public PUSH(ConstantPoolGen cp, int value) {
         if ((value >= -1) && (value <= 5)) {
-            instruction = InstructionConstants.getInstruction(Constants.ICONST_0 + value);
+            instruction = InstructionConst.getInstruction(Constants.ICONST_0 + value);
         } else if (Instruction.isValidByte(value)) {
             instruction = new BIPUSH((byte) value);
         } else if (Instruction.isValidShort(value)) {
@@ -54,7 +54,7 @@ public final class PUSH implements Compo
      * @param value to be pushed 
      */
     public PUSH(ConstantPoolGen cp, boolean value) {
-        instruction = InstructionConstants.getInstruction(Constants.ICONST_0 + (value ? 1 : 0));
+        instruction = InstructionConst.getInstruction(Constants.ICONST_0 + (value ? 1 : 0));
     }
 
 
@@ -64,11 +64,11 @@ public final class PUSH implements Compo
      */
     public PUSH(ConstantPoolGen cp, float value) {
         if (value == 0.0) {
-            instruction = InstructionConstants.FCONST_0;
+            instruction = InstructionConst.FCONST_0;
         } else if (value == 1.0) {
-            instruction = InstructionConstants.FCONST_1;
+            instruction = InstructionConst.FCONST_1;
         } else if (value == 2.0) {
-            instruction = InstructionConstants.FCONST_2;
+            instruction = InstructionConst.FCONST_2;
         } else {
             instruction = new LDC(cp.addFloat(value));
         }
@@ -81,9 +81,9 @@ public final class PUSH implements Compo
      */
     public PUSH(ConstantPoolGen cp, long value) {
         if (value == 0) {
-            instruction = InstructionConstants.LCONST_0;
+            instruction = InstructionConst.LCONST_0;
         } else if (value == 1) {
-            instruction = InstructionConstants.LCONST_1;
+            instruction = InstructionConst.LCONST_1;
         } else {
             instruction = new LDC2_W(cp.addLong(value));
         }
@@ -96,9 +96,9 @@ public final class PUSH implements Compo
      */
     public PUSH(ConstantPoolGen cp, double value) {
         if (value == 0.0) {
-            instruction = InstructionConstants.DCONST_0;
+            instruction = InstructionConst.DCONST_0;
         } else if (value == 1.0) {
-            instruction = InstructionConstants.DCONST_1;
+            instruction = InstructionConst.DCONST_1;
         } else {
             instruction = new LDC2_W(cp.addDouble(value));
         }
@@ -111,7 +111,7 @@ public final class PUSH implements Compo
      */
     public PUSH(ConstantPoolGen cp, String value) {
         if (value == null) {
-            instruction = InstructionConstants.ACONST_NULL;
+            instruction = InstructionConst.ACONST_NULL;
         } else {
             instruction = new LDC(cp.addString(value));
         }
@@ -125,7 +125,7 @@ public final class PUSH implements Compo
      */
     public PUSH(ConstantPoolGen cp, ObjectType value) {
         if (value == null) {
-            instruction = InstructionConstants.ACONST_NULL;
+            instruction = InstructionConst.ACONST_NULL;
         } else {
             instruction = new LDC(cp.addClass(value));
         }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELFactory.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELFactory.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELFactory.java Fri Sep 11 00:01:16 2015
@@ -41,7 +41,7 @@ import org.apache.commons.bcel6.generic.
 import org.apache.commons.bcel6.generic.IINC;
 import org.apache.commons.bcel6.generic.INSTANCEOF;
 import org.apache.commons.bcel6.generic.Instruction;
-import org.apache.commons.bcel6.generic.InstructionConstants;
+import org.apache.commons.bcel6.generic.InstructionConst;
 import org.apache.commons.bcel6.generic.InstructionHandle;
 import org.apache.commons.bcel6.generic.InvokeInstruction;
 import org.apache.commons.bcel6.generic.LDC;
@@ -108,9 +108,9 @@ class BCELFactory extends EmptyVisitor {
 
     private boolean visitInstruction( Instruction i ) {
         short opcode = i.getOpcode();
-        if ((InstructionConstants.getInstruction(opcode) != null)
+        if ((InstructionConst.getInstruction(opcode) != null)
                 && !(i instanceof ConstantPushInstruction) && !(i instanceof ReturnInstruction)) { // Handled below
-            _out.println("il.append(InstructionConstants."
+            _out.println("il.append(InstructionConst."
                     + i.getName().toUpperCase(Locale.ENGLISH) + ");");
             return true;
         }

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/GeneratingAnnotatedClassesTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/GeneratingAnnotatedClassesTestCase.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/GeneratingAnnotatedClassesTestCase.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/GeneratingAnnotatedClassesTestCase.java Fri Sep 11 00:01:16 2015
@@ -427,9 +427,9 @@ public class GeneratingAnnotatedClassesT
         // to the BufferedReader object stays on top of the stack and is stored
         // in the newly allocated in variable.
         il.append(factory.createNew("java.io.BufferedReader"));
-        il.append(InstructionConstants.DUP); // Use predefined constant
+        il.append(InstructionConst.DUP); // Use predefined constant
         il.append(factory.createNew("java.io.InputStreamReader"));
-        il.append(InstructionConstants.DUP);
+        il.append(InstructionConst.DUP);
         il.append(factory.createFieldAccess("java.lang.System", "in", i_stream,
                 Constants.GETSTATIC));
         il.append(factory.createInvoke("java.io.InputStreamReader", "<init>",
@@ -444,7 +444,7 @@ public class GeneratingAnnotatedClassesT
         // Create local variable name and initialize it to null
         lg = mg.addLocalVariable("name", Type.STRING, null, null);
         int name = lg.getIndex();
-        il.append(InstructionConstants.ACONST_NULL);
+        il.append(InstructionConst.ACONST_NULL);
         lg.setStart(il.append(new ASTORE(name))); // "name" valid from here
         // Create try-catch block: We remember the start of the block, read a
         // line from the standard input and store it into the variable name .
@@ -469,7 +469,7 @@ public class GeneratingAnnotatedClassesT
         int var_ex_slot = var_ex.getIndex();
         InstructionHandle handler = il.append(new ASTORE(var_ex_slot));
         var_ex.setStart(handler);
-        var_ex.setEnd(il.append(InstructionConstants.RETURN));
+        var_ex.setEnd(il.append(InstructionConst.RETURN));
         mg.addExceptionHandler(try_start, try_end, handler, new ObjectType(
                 "java.io.IOException"));
         // "Normal" code continues, now we can set the branch target of the GOTO
@@ -480,7 +480,7 @@ public class GeneratingAnnotatedClassesT
         // Printing "Hello": String concatenation compiles to StringBuffer
         // operations.
         il.append(factory.createNew(Type.STRINGBUFFER));
-        il.append(InstructionConstants.DUP);
+        il.append(InstructionConst.DUP);
         il.append(new PUSH(cp, "Hello, "));
         il
                 .append(factory.createInvoke("java.lang.StringBuffer",
@@ -496,7 +496,7 @@ public class GeneratingAnnotatedClassesT
                 .append(factory.createInvoke("java.io.PrintStream", "println",
                         Type.VOID, new Type[] { Type.STRING },
                         Constants.INVOKEVIRTUAL));
-        il.append(InstructionConstants.RETURN);
+        il.append(InstructionConst.RETURN);
         // Finalization: Finally, we have to set the stack size, which normally
         // would have to be computed on the fly and add a default constructor
         // method to the class, which is empty in this case.
@@ -521,9 +521,9 @@ public class GeneratingAnnotatedClassesT
         // to the BufferedReader object stays on top of the stack and is stored
         // in the newly allocated in variable.
         il.append(factory.createNew("java.io.BufferedReader"));
-        il.append(InstructionConstants.DUP); // Use predefined constant
+        il.append(InstructionConst.DUP); // Use predefined constant
         il.append(factory.createNew("java.io.InputStreamReader"));
-        il.append(InstructionConstants.DUP);
+        il.append(InstructionConst.DUP);
         il.append(factory.createFieldAccess("java.lang.System", "in", i_stream,
                 Constants.GETSTATIC));
         il.append(factory.createInvoke("java.io.InputStreamReader", "<init>",
@@ -538,7 +538,7 @@ public class GeneratingAnnotatedClassesT
         // Create local variable name and initialize it to null
         lg = mg.addLocalVariable("name", Type.STRING, null, null);
         int name = lg.getIndex();
-        il.append(InstructionConstants.ACONST_NULL);
+        il.append(InstructionConst.ACONST_NULL);
         lg.setStart(il.append(new ASTORE(name))); // "name" valid from here
         // Create try-catch block: We remember the start of the block, read a
         // line from the standard input and store it into the variable name .
@@ -563,7 +563,7 @@ public class GeneratingAnnotatedClassesT
         int var_ex_slot = var_ex.getIndex();
         InstructionHandle handler = il.append(new ASTORE(var_ex_slot));
         var_ex.setStart(handler);
-        var_ex.setEnd(il.append(InstructionConstants.RETURN));
+        var_ex.setEnd(il.append(InstructionConst.RETURN));
         mg.addExceptionHandler(try_start, try_end, handler, new ObjectType(
                 "java.io.IOException"));
         // "Normal" code continues, now we can set the branch target of the GOTO
@@ -574,7 +574,7 @@ public class GeneratingAnnotatedClassesT
         // Printing "Hello": String concatenation compiles to StringBuffer
         // operations.
         il.append(factory.createNew(Type.STRINGBUFFER));
-        il.append(InstructionConstants.DUP);
+        il.append(InstructionConst.DUP);
         il.append(new PUSH(cp, "Hello, "));
         il
                 .append(factory.createInvoke("java.lang.StringBuffer",
@@ -590,7 +590,7 @@ public class GeneratingAnnotatedClassesT
                 .append(factory.createInvoke("java.io.PrintStream", "println",
                         Type.VOID, new Type[] { Type.STRING },
                         Constants.INVOKEVIRTUAL));
-        il.append(InstructionConstants.RETURN);
+        il.append(InstructionConst.RETURN);
         // Finalization: Finally, we have to set the stack size, which normally
         // would have to be computed on the fly and add a default constructor
         // method to the class, which is empty in this case.

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/InstructionHandleTestCase.java Fri Sep 11 00:01:16 2015
@@ -39,7 +39,7 @@ public class InstructionHandleTestCase {
     @Test
     public void testBCEL195() {
         InstructionList il = new InstructionList();
-        InstructionHandle ih = il.append(InstructionConstants.NOP);
+        InstructionHandle ih = il.append(InstructionConst.NOP);
         new TABLESWITCH(new int[0], new InstructionHandle[0], ih);
         new TABLESWITCH(new int[0], new InstructionHandle[0], ih);
     }

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java Fri Sep 11 00:01:16 2015
@@ -23,7 +23,7 @@ import java.io.OutputStream;
 import org.apache.commons.bcel6.Constants;
 import org.apache.commons.bcel6.generic.ClassGen;
 import org.apache.commons.bcel6.generic.ConstantPoolGen;
-import org.apache.commons.bcel6.generic.InstructionConstants;
+import org.apache.commons.bcel6.generic.InstructionConst;
 import org.apache.commons.bcel6.generic.InstructionFactory;
 import org.apache.commons.bcel6.generic.InstructionHandle;
 import org.apache.commons.bcel6.generic.InstructionList;
@@ -86,9 +86,9 @@ public void create(OutputStream out) thr
     Assert.assertNotNull(ih_10); // TODO why is this not used
     il.append(new PUSH(_cp, 0));
     il.append(_factory.createNew(TEST_PACKAGE+".TestArrayAccess02"));
-    il.append(InstructionConstants.DUP);
+    il.append(InstructionConst.DUP);
     il.append(_factory.createInvoke(TEST_PACKAGE+".TestArrayAccess02", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
-    il.append(InstructionConstants.AASTORE);
+    il.append(InstructionConst.AASTORE);
     InstructionHandle ih_20 = il.append(InstructionFactory.createReturn(Type.VOID));
     Assert.assertNotNull(ih_20); // TODO why is this not used
     method.setMaxStack();

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java Fri Sep 11 00:01:16 2015
@@ -23,7 +23,7 @@ import java.io.OutputStream;
 import org.apache.commons.bcel6.Constants;
 import org.apache.commons.bcel6.generic.ClassGen;
 import org.apache.commons.bcel6.generic.ConstantPoolGen;
-import org.apache.commons.bcel6.generic.InstructionConstants;
+import org.apache.commons.bcel6.generic.InstructionConst;
 import org.apache.commons.bcel6.generic.InstructionFactory;
 import org.apache.commons.bcel6.generic.InstructionHandle;
 import org.apache.commons.bcel6.generic.InstructionList;
@@ -82,9 +82,9 @@ public void create(OutputStream out) thr
     Assert.assertNotNull(ih_5); // TODO why is this not used
     il.append(new PUSH(_cp, 0));
     il.append(_factory.createNew(TEST_PACKAGE+".TestArrayAccess03"));
-    il.append(InstructionConstants.DUP);
+    il.append(InstructionConst.DUP);
     il.append(_factory.createInvoke(TEST_PACKAGE+".TestArrayAccess03", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
-    il.append(InstructionConstants.AASTORE);
+    il.append(InstructionConst.AASTORE);
     InstructionHandle ih_15 = il.append(InstructionFactory.createReturn(Type.VOID));
     Assert.assertNotNull(ih_15); // TODO why is this not used
     method.setMaxStack();

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java Fri Sep 11 00:01:16 2015
@@ -24,7 +24,7 @@ import java.io.OutputStream;
 import org.apache.commons.bcel6.Constants;
 import org.apache.commons.bcel6.generic.ClassGen;
 import org.apache.commons.bcel6.generic.ConstantPoolGen;
-import org.apache.commons.bcel6.generic.InstructionConstants;
+import org.apache.commons.bcel6.generic.InstructionConst;
 import org.apache.commons.bcel6.generic.InstructionFactory;
 import org.apache.commons.bcel6.generic.InstructionHandle;
 import org.apache.commons.bcel6.generic.InstructionList;
@@ -85,7 +85,7 @@ public void create(OutputStream out) thr
     Assert.assertNotNull(ih_7); // TODO why is this not used
     il.append(new PUSH(_cp, 0));
     il.append(InstructionFactory.createLoad(Type.INT, 2));
-    il.append(InstructionConstants.AASTORE);
+    il.append(InstructionConst.AASTORE);
     InstructionHandle ih_11 = il.append(InstructionFactory.createReturn(Type.VOID));
     Assert.assertNotNull(ih_11); // TODO why is this not used
     method.setMaxStack();

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java Fri Sep 11 00:01:16 2015
@@ -23,7 +23,7 @@ import java.io.OutputStream;
 import org.apache.commons.bcel6.Constants;
 import org.apache.commons.bcel6.generic.ClassGen;
 import org.apache.commons.bcel6.generic.ConstantPoolGen;
-import org.apache.commons.bcel6.generic.InstructionConstants;
+import org.apache.commons.bcel6.generic.InstructionConst;
 import org.apache.commons.bcel6.generic.InstructionFactory;
 import org.apache.commons.bcel6.generic.InstructionHandle;
 import org.apache.commons.bcel6.generic.InstructionList;
@@ -74,9 +74,9 @@ public void create(OutputStream out) thr
 
     InstructionHandle ih_0 = il.append(_factory.createNew("java.lang.Object"));
     Assert.assertNotNull(ih_0); // TODO why is this not used
-    il.append(InstructionConstants.DUP);
+    il.append(InstructionConst.DUP);
     il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
-    il.append(InstructionConstants.NOP);
+    il.append(InstructionConst.NOP);
     InstructionHandle ih_8 = il.append(InstructionFactory.createReturn(Type.OBJECT));
     Assert.assertNotNull(ih_8); // TODO why is this not used
     method.setMaxStack();

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java?rev=1702352&r1=1702351&r2=1702352&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java Fri Sep 11 00:01:16 2015
@@ -23,7 +23,7 @@ import java.io.OutputStream;
 import org.apache.commons.bcel6.Constants;
 import org.apache.commons.bcel6.generic.ClassGen;
 import org.apache.commons.bcel6.generic.ConstantPoolGen;
-import org.apache.commons.bcel6.generic.InstructionConstants;
+import org.apache.commons.bcel6.generic.InstructionConst;
 import org.apache.commons.bcel6.generic.InstructionFactory;
 import org.apache.commons.bcel6.generic.InstructionHandle;
 import org.apache.commons.bcel6.generic.InstructionList;
@@ -72,7 +72,7 @@ public void create(OutputStream out) thr
     MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.INT, Type.NO_ARGS,
             new String[] {  }, "test3", TEST_PACKAGE+".TestReturn03", il, _cp);
 
-    InstructionHandle ih_0 = il.append(InstructionConstants.ACONST_NULL);
+    InstructionHandle ih_0 = il.append(InstructionConst.ACONST_NULL);
     Assert.assertNotNull(ih_0); // TODO why is this not used
     il.append(InstructionFactory.createReturn(Type.OBJECT));
     method.setMaxStack();



Mime
View raw message