001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   https://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.bcel.generic;
020
021/**
022 * Contains shareable instruction objects.
023 * <p>
024 * In order to save memory you can use some instructions multiply, since they have an immutable state and are directly
025 * derived from Instruction. I.e. they have no instance fields that could be changed. Since some of these instructions
026 * like ICONST_0 occur very frequently this can save a lot of time and space. This feature is an adaptation of the
027 * FlyWeight design pattern, we just use an array instead of a factory.
028 * </p>
029 * <p>
030 * The Instructions can also accessed directly under their names, so it's possible to write
031 * il.append(Instruction.ICONST_0);
032 * </p>
033 *
034 * @deprecated (since 6.0) Do not use. Use {@link InstructionConst} instead.
035 */
036@Deprecated
037public interface InstructionConstants {
038
039    /**
040     * Deprecated, consider private and ignore.
041     */
042    class Clinit {
043        // empty
044    }
045
046    /*
047     * NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length.
048     */
049    Instruction NOP = InstructionConst.NOP;
050    Instruction ACONST_NULL = InstructionConst.ACONST_NULL;
051    Instruction ICONST_M1 = InstructionConst.ICONST_M1;
052    Instruction ICONST_0 = InstructionConst.ICONST_0;
053    Instruction ICONST_1 = InstructionConst.ICONST_1;
054    Instruction ICONST_2 = InstructionConst.ICONST_2;
055    Instruction ICONST_3 = InstructionConst.ICONST_3;
056    Instruction ICONST_4 = InstructionConst.ICONST_4;
057    Instruction ICONST_5 = InstructionConst.ICONST_5;
058    Instruction LCONST_0 = InstructionConst.LCONST_0;
059    Instruction LCONST_1 = InstructionConst.LCONST_1;
060    Instruction FCONST_0 = InstructionConst.FCONST_0;
061    Instruction FCONST_1 = InstructionConst.FCONST_1;
062    Instruction FCONST_2 = InstructionConst.FCONST_2;
063    Instruction DCONST_0 = InstructionConst.DCONST_0;
064    Instruction DCONST_1 = InstructionConst.DCONST_1;
065    ArrayInstruction IALOAD = InstructionConst.IALOAD;
066    ArrayInstruction LALOAD = InstructionConst.LALOAD;
067    ArrayInstruction FALOAD = InstructionConst.FALOAD;
068    ArrayInstruction DALOAD = InstructionConst.DALOAD;
069    ArrayInstruction AALOAD = InstructionConst.AALOAD;
070    ArrayInstruction BALOAD = InstructionConst.BALOAD;
071    ArrayInstruction CALOAD = InstructionConst.CALOAD;
072    ArrayInstruction SALOAD = InstructionConst.SALOAD;
073    ArrayInstruction IASTORE = InstructionConst.IASTORE;
074    ArrayInstruction LASTORE = InstructionConst.LASTORE;
075    ArrayInstruction FASTORE = InstructionConst.FASTORE;
076    ArrayInstruction DASTORE = InstructionConst.DASTORE;
077    ArrayInstruction AASTORE = InstructionConst.AASTORE;
078    ArrayInstruction BASTORE = InstructionConst.BASTORE;
079    ArrayInstruction CASTORE = InstructionConst.CASTORE;
080    ArrayInstruction SASTORE = InstructionConst.SASTORE;
081    StackInstruction POP = InstructionConst.POP;
082    StackInstruction POP2 = InstructionConst.POP2;
083    StackInstruction DUP = InstructionConst.DUP;
084    StackInstruction DUP_X1 = InstructionConst.DUP_X1;
085    StackInstruction DUP_X2 = InstructionConst.DUP_X2;
086    StackInstruction DUP2 = InstructionConst.DUP2;
087    StackInstruction DUP2_X1 = InstructionConst.DUP2_X1;
088    StackInstruction DUP2_X2 = InstructionConst.DUP2_X2;
089    StackInstruction SWAP = InstructionConst.SWAP;
090    ArithmeticInstruction IADD = InstructionConst.IADD;
091    ArithmeticInstruction LADD = InstructionConst.LADD;
092    ArithmeticInstruction FADD = InstructionConst.FADD;
093    ArithmeticInstruction DADD = InstructionConst.DADD;
094    ArithmeticInstruction ISUB = InstructionConst.ISUB;
095    ArithmeticInstruction LSUB = InstructionConst.LSUB;
096    ArithmeticInstruction FSUB = InstructionConst.FSUB;
097    ArithmeticInstruction DSUB = InstructionConst.DSUB;
098    ArithmeticInstruction IMUL = InstructionConst.IMUL;
099    ArithmeticInstruction LMUL = InstructionConst.LMUL;
100    ArithmeticInstruction FMUL = InstructionConst.FMUL;
101    ArithmeticInstruction DMUL = InstructionConst.DMUL;
102    ArithmeticInstruction IDIV = InstructionConst.IDIV;
103    ArithmeticInstruction LDIV = InstructionConst.LDIV;
104    ArithmeticInstruction FDIV = InstructionConst.FDIV;
105    ArithmeticInstruction DDIV = InstructionConst.DDIV;
106    ArithmeticInstruction IREM = InstructionConst.IREM;
107    ArithmeticInstruction LREM = InstructionConst.LREM;
108    ArithmeticInstruction FREM = InstructionConst.FREM;
109    ArithmeticInstruction DREM = InstructionConst.DREM;
110    ArithmeticInstruction INEG = InstructionConst.INEG;
111    ArithmeticInstruction LNEG = InstructionConst.LNEG;
112    ArithmeticInstruction FNEG = InstructionConst.FNEG;
113    ArithmeticInstruction DNEG = InstructionConst.DNEG;
114    ArithmeticInstruction ISHL = InstructionConst.ISHL;
115    ArithmeticInstruction LSHL = InstructionConst.LSHL;
116    ArithmeticInstruction ISHR = InstructionConst.ISHR;
117    ArithmeticInstruction LSHR = InstructionConst.LSHR;
118    ArithmeticInstruction IUSHR = InstructionConst.IUSHR;
119    ArithmeticInstruction LUSHR = InstructionConst.LUSHR;
120    ArithmeticInstruction IAND = InstructionConst.IAND;
121    ArithmeticInstruction LAND = InstructionConst.LAND;
122    ArithmeticInstruction IOR = InstructionConst.IOR;
123    ArithmeticInstruction LOR = InstructionConst.LOR;
124    ArithmeticInstruction IXOR = InstructionConst.IXOR;
125    ArithmeticInstruction LXOR = InstructionConst.LXOR;
126    ConversionInstruction I2L = InstructionConst.I2L;
127    ConversionInstruction I2F = InstructionConst.I2F;
128    ConversionInstruction I2D = InstructionConst.I2D;
129    ConversionInstruction L2I = InstructionConst.L2I;
130    ConversionInstruction L2F = InstructionConst.L2F;
131    ConversionInstruction L2D = InstructionConst.L2D;
132    ConversionInstruction F2I = InstructionConst.F2I;
133    ConversionInstruction F2L = InstructionConst.F2L;
134    ConversionInstruction F2D = InstructionConst.F2D;
135    ConversionInstruction D2I = InstructionConst.D2I;
136    ConversionInstruction D2L = InstructionConst.D2L;
137    ConversionInstruction D2F = InstructionConst.D2F;
138    ConversionInstruction I2B = InstructionConst.I2B;
139    ConversionInstruction I2C = InstructionConst.I2C;
140    ConversionInstruction I2S = InstructionConst.I2S;
141    Instruction LCMP = InstructionConst.LCMP;
142    Instruction FCMPL = InstructionConst.FCMPL;
143    Instruction FCMPG = InstructionConst.FCMPG;
144    Instruction DCMPL = InstructionConst.DCMPL;
145    Instruction DCMPG = InstructionConst.DCMPG;
146    ReturnInstruction IRETURN = InstructionConst.IRETURN;
147    ReturnInstruction LRETURN = InstructionConst.LRETURN;
148    ReturnInstruction FRETURN = InstructionConst.FRETURN;
149    ReturnInstruction DRETURN = InstructionConst.DRETURN;
150    ReturnInstruction ARETURN = InstructionConst.ARETURN;
151    ReturnInstruction RETURN = InstructionConst.RETURN;
152    Instruction ARRAYLENGTH = InstructionConst.ARRAYLENGTH;
153    Instruction ATHROW = InstructionConst.ATHROW;
154    Instruction MONITORENTER = InstructionConst.MONITORENTER;
155    Instruction MONITOREXIT = InstructionConst.MONITOREXIT;
156
157    /**
158     * You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal
159     * values, for example call setIndex().
160     */
161    LocalVariableInstruction THIS = InstructionConst.THIS;
162    LocalVariableInstruction ALOAD_0 = InstructionConst.ALOAD_0;
163    LocalVariableInstruction ALOAD_1 = InstructionConst.ALOAD_1;
164    LocalVariableInstruction ALOAD_2 = InstructionConst.ALOAD_2;
165    LocalVariableInstruction ILOAD_0 = InstructionConst.ILOAD_0;
166    LocalVariableInstruction ILOAD_1 = InstructionConst.ILOAD_1;
167    LocalVariableInstruction ILOAD_2 = InstructionConst.ILOAD_2;
168    LocalVariableInstruction ASTORE_0 = InstructionConst.ASTORE_0;
169    LocalVariableInstruction ASTORE_1 = InstructionConst.ASTORE_1;
170    LocalVariableInstruction ASTORE_2 = InstructionConst.ASTORE_2;
171    LocalVariableInstruction ISTORE_0 = InstructionConst.ISTORE_0;
172    LocalVariableInstruction ISTORE_1 = InstructionConst.ISTORE_1;
173    LocalVariableInstruction ISTORE_2 = InstructionConst.ISTORE_2;
174
175    /**
176     * Gets object via its opcode, for immutable instructions like branch instructions entries are set to null.
177     */
178    Instruction[] INSTRUCTIONS = InstructionConst.INSTRUCTIONS;
179
180    /**
181     * Interfaces may have no static initializers, so we simulate this with an inner class.
182     */
183    Clinit bla = new Clinit();
184}