From: markt
This operation inflates the original byte array by roughly 40-50%
- * - * @param bytes the byte array to convert - * @param compress use gzip to minimize string - */ - public static String encode( byte[] bytes, boolean compress ) throws IOException { - if (compress) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - GZIPOutputStream gos = new GZIPOutputStream(baos); - gos.write(bytes, 0, bytes.length); - gos.close(); - baos.close(); - bytes = baos.toByteArray(); - } - CharArrayWriter caw = new CharArrayWriter(); - JavaWriter jw = new JavaWriter(caw); - for (int i = 0; i < bytes.length; i++) { - int in = bytes[i] & 0x000000ff; // Normalize to unsigned - jw.write(in); - } - return caw.toString(); - } + - /** Decode a string back to a byte array. - * - * @param s the string to convert - * @param uncompress use gzip to uncompress the stream of bytes - */ - public static byte[] decode( String s, boolean uncompress ) throws IOException { - char[] chars = s.toCharArray(); - CharArrayReader car = new CharArrayReader(chars); - JavaReader jr = new JavaReader(car); - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - int ch; - while ((ch = jr.read()) >= 0) { - bos.write(ch); - } - bos.close(); - car.close(); - jr.close(); - byte[] bytes = bos.toByteArray(); - if (uncompress) { - GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); - byte[] tmp = new byte[bytes.length * 3]; // Rough estimate - int count = 0; - int b; - while ((b = gis.read()) >= 0) { - tmp[count++] = (byte) b; - } - bytes = new byte[count]; - System.arraycopy(tmp, 0, bytes, 0, count); - } - return bytes; - } + // A-Z, g-z, _, $ private static final int FREE_CHARS = 48; @@ -1347,179 +994,9 @@ public abstract class Utility { } - /** - * Converts a list of AnnotationGen objects into a set of attributes - * that can be attached to the class file. - * - * @param cp The constant pool gen where we can create the necessary name refs - * @param vec A list of AnnotationGen objects - */ - public static Attribute[] getAnnotationAttributes(ConstantPoolGen cp,List vec) { - - if (vec.isEmpty()) return new Attribute[0]; - - try { - int countVisible = 0; - int countInvisible = 0; - - // put the annotations in the right output stream - for (int i=0; iStack: ..., arrayref, index -> value- * - * @version $Id$ - * @author M. Dahm - */ -public class AALOAD extends ArrayInstruction implements StackProducer { - - /** Load reference from array - */ - public AALOAD() { - super(org.apache.tomcat.util.bcel.Constants.AALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/AASTORE.java b/java/org/apache/tomcat/util/bcel/generic/AASTORE.java deleted file mode 100644 index 45b9fca2f..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/AASTORE.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * AASTORE - Store into reference array - *
Stack: ..., arrayref, index, value -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class AASTORE extends ArrayInstruction implements StackConsumer { - - /** Store into reference array - */ - public AASTORE() { - super(org.apache.tomcat.util.bcel.Constants.AASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ACONST_NULL.java b/java/org/apache/tomcat/util/bcel/generic/ACONST_NULL.java deleted file mode 100644 index ac8ece469..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ACONST_NULL.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ACONST_NULL - Push null reference - *
Stack: ... -> ..., null- * - * @version $Id$ - * @author M. Dahm - */ -public class ACONST_NULL extends Instruction implements PushInstruction, TypedInstruction { - - /** - * Push null reference - */ - public ACONST_NULL() { - super(org.apache.tomcat.util.bcel.Constants.ACONST_NULL, (short) 1); - } - - - /** @return Type.NULL - */ - public Type getType( ConstantPoolGen cp ) { - return Type.NULL; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java b/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java index a6c46a814..355f1db7b 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java +++ b/java/org/apache/tomcat/util/bcel/generic/ANEWARRAY.java @@ -16,8 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * ANEWARRAY - Create new array of references *
Stack: ..., count -> ..., arrayref@@ -36,25 +34,11 @@ public class ANEWARRAY extends CPInstruction implements LoadClass, AllocationIns } - public ANEWARRAY(int index) { - super(org.apache.tomcat.util.bcel.Constants.ANEWARRAY, index); - } + - public Class[] getExceptions() { - Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); - cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION; - return cs; - } + - public ObjectType getLoadClassType( ConstantPoolGen cpg ) { - Type t = getType(cpg); - if (t instanceof ArrayType) { - t = ((ArrayType) t).getBasicType(); - } - return (t instanceof ObjectType) ? (ObjectType) t : null; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/ARETURN.java b/java/org/apache/tomcat/util/bcel/generic/ARETURN.java deleted file mode 100644 index e8c659723..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ARETURN.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ARETURN - Return reference from method - *
Stack: ..., objectref -> <empty>- * - * @version $Id$ - * @author M. Dahm - */ -public class ARETURN extends ReturnInstruction { - - /** - * Return reference from method - */ - public ARETURN() { - super(org.apache.tomcat.util.bcel.Constants.ARETURN); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ARRAYLENGTH.java b/java/org/apache/tomcat/util/bcel/generic/ARRAYLENGTH.java deleted file mode 100644 index fb2840c50..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ARRAYLENGTH.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ARRAYLENGTH - Get length of array - *
Stack: ..., arrayref -> ..., length- * - * @version $Id$ - * @author M. Dahm - */ -public class ARRAYLENGTH extends Instruction implements ExceptionThrower, StackProducer, StackConsumer { - - /** Get length of array - */ - public ARRAYLENGTH() { - super(org.apache.tomcat.util.bcel.Constants.ARRAYLENGTH, (short) 1); - } - - - /** @return exceptions this instruction may cause - */ - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ATHROW.java b/java/org/apache/tomcat/util/bcel/generic/ATHROW.java deleted file mode 100644 index daff3dc4c..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ATHROW.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ATHROW - Throw exception - *
Stack: ..., objectref -> objectref- * - * @version $Id$ - * @author M. Dahm - */ -public class ATHROW extends Instruction implements UnconditionalBranch, ExceptionThrower { - - /** - * Throw exception - */ - public ATHROW() { - super(org.apache.tomcat.util.bcel.Constants.ATHROW, (short) 1); - } - - - /** @return exceptions this instruction may cause - */ - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.THROWABLE - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java b/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java index dc1a468eb..c5b07ee95 100644 --- a/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/AnnotationElementValueGen.java @@ -10,21 +10,9 @@ public class AnnotationElementValueGen extends ElementValueGen // For annotation element values, this is the annotation private AnnotationEntryGen a; - public AnnotationElementValueGen(AnnotationEntryGen a, ConstantPoolGen cpool) - { - super(ANNOTATION, cpool); - this.a = a; - } + - public AnnotationElementValueGen(int type, AnnotationEntryGen annotation, - ConstantPoolGen cpool) - { - super(type, cpool); - if (type != ANNOTATION) - throw new RuntimeException( - "Only element values of type annotation can be built with this ctor - type specified: " + type); - this.a = annotation; - } + public AnnotationElementValueGen(AnnotationElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries) @@ -53,8 +41,5 @@ public class AnnotationElementValueGen extends ElementValueGen .getConstantPool()); } - public AnnotationEntryGen getAnnotation() - { - return a; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java b/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java index ee0d0be40..57857c2f2 100755 --- a/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/AnnotationEntryGen.java @@ -1,6 +1,5 @@ package org.apache.tomcat.util.bcel.generic; -import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.ArrayList; @@ -58,11 +57,6 @@ public class AnnotationEntryGen return out; } - private AnnotationEntryGen(ConstantPoolGen cpool) - { - this.cpool = cpool; - } - /** * Retrieve an immutable version of this AnnotationGen */ @@ -79,31 +73,9 @@ public class AnnotationEntryGen return a; } - public AnnotationEntryGen(ObjectType type, - List /* ElementNameValuePairGen */elements, boolean vis, - ConstantPoolGen cpool) - { - this.cpool = cpool; - this.typeIndex = cpool.addUtf8(type.getSignature()); - evs = elements; - isRuntimeVisible = vis; - } + - public static AnnotationEntryGen read(DataInputStream dis, - ConstantPoolGen cpool, boolean b) throws IOException - { - AnnotationEntryGen a = new AnnotationEntryGen(cpool); - a.typeIndex = dis.readUnsignedShort(); - int elemValuePairCount = dis.readUnsignedShort(); - for (int i = 0; i < elemValuePairCount; i++) - { - int nidx = dis.readUnsignedShort(); - a.addElementNameValuePair(new ElementValuePairGen(nidx, - ElementValueGen.readElementValue(dis, cpool), cpool)); - } - a.isRuntimeVisible(b); - return a; - } + public void dump(DataOutputStream dos) throws IOException { @@ -116,17 +88,9 @@ public class AnnotationEntryGen } } - public void addElementNameValuePair(ElementValuePairGen evp) - { - if (evs == null) - evs = new ArrayList(); - evs.add(evp); - } + - public int getTypeIndex() - { - return typeIndex; - } + public final String getTypeSignature() { @@ -142,13 +106,7 @@ public class AnnotationEntryGen // Utility.signatureToString(getTypeSignature()); } - /** - * Returns list of ElementNameValuePair objects - */ - public List getValues() - { - return evs; - } + public String toString() { @@ -164,27 +122,7 @@ public class AnnotationEntryGen return s.toString(); } - public String toShortString() - { - StringBuffer s = new StringBuffer(); - s.append("@" + getTypeName() + "("); - for (int i = 0; i < evs.size(); i++) - { - s.append(evs.get(i)); - if (i + 1 < evs.size()) - s.append(","); - } - s.append(")"); - return s.toString(); - } - - private void isRuntimeVisible(boolean b) - { - isRuntimeVisible = b; - } + - public boolean isRuntimeVisible() - { - return isRuntimeVisible; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/ArithmeticInstruction.java b/java/org/apache/tomcat/util/bcel/generic/ArithmeticInstruction.java deleted file mode 100644 index 1337f63c5..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ArithmeticInstruction.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -import org.apache.tomcat.util.bcel.Constants; - -/** - * Super class for the family of arithmetic instructions. - * - * @version $Id$ - * @author M. Dahm - */ -public abstract class ArithmeticInstruction extends Instruction implements TypedInstruction, - StackProducer, StackConsumer { - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - ArithmeticInstruction() { - } - - - /** - * @param opcode of instruction - */ - protected ArithmeticInstruction(short opcode) { - super(opcode, (short) 1); - } - - - /** @return type associated with the instruction - */ - public Type getType( ConstantPoolGen cp ) { - switch (opcode) { - case Constants.DADD: - case Constants.DDIV: - case Constants.DMUL: - case Constants.DNEG: - case Constants.DREM: - case Constants.DSUB: - return Type.DOUBLE; - case Constants.FADD: - case Constants.FDIV: - case Constants.FMUL: - case Constants.FNEG: - case Constants.FREM: - case Constants.FSUB: - return Type.FLOAT; - case Constants.IADD: - case Constants.IAND: - case Constants.IDIV: - case Constants.IMUL: - case Constants.INEG: - case Constants.IOR: - case Constants.IREM: - case Constants.ISHL: - case Constants.ISHR: - case Constants.ISUB: - case Constants.IUSHR: - case Constants.IXOR: - return Type.INT; - case Constants.LADD: - case Constants.LAND: - case Constants.LDIV: - case Constants.LMUL: - case Constants.LNEG: - case Constants.LOR: - case Constants.LREM: - case Constants.LSHL: - case Constants.LSHR: - case Constants.LSUB: - case Constants.LUSHR: - case Constants.LXOR: - return Type.LONG; - default: // Never reached - throw new ClassGenException("Unknown type " + opcode); - } - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java b/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java index f05b14907..6fb40e213 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/ArrayElementValueGen.java @@ -14,25 +14,9 @@ public class ArrayElementValueGen extends ElementValueGen // modify ... private List /* ElementValueGen */evalues; - public ArrayElementValueGen(ConstantPoolGen cp) - { - super(ARRAY, cp); - evalues = new ArrayList(); - } + - public ArrayElementValueGen(int type, ElementValue[] datums, - ConstantPoolGen cpool) - { - super(type, cpool); - if (type != ARRAY) - throw new RuntimeException( - "Only element values of type array can be built with this ctor - type specified: " + type); - this.evalues = new ArrayList(); - for (int i = 0; i < datums.length; i++) - { - evalues.add(datums[i]); - } - } + /** * Return immutable variant of this ArrayElementValueGen @@ -92,18 +76,9 @@ public class ArrayElementValueGen extends ElementValueGen return sb.toString(); } - public List getElementValues() - { - return evalues; - } + - public int getElementValuesSize() - { - return evalues.size(); - } + - public void addElement(ElementValueGen gen) - { - evalues.add(gen); - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/ArrayInstruction.java b/java/org/apache/tomcat/util/bcel/generic/ArrayInstruction.java deleted file mode 100644 index ac358d988..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ArrayInstruction.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * Super class for instructions dealing with array access such as IALOAD. - * - * @version $Id$ - * @author M. Dahm - */ -public abstract class ArrayInstruction extends Instruction implements ExceptionThrower, - TypedInstruction { - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - ArrayInstruction() { - } - - - /** - * @param opcode of instruction - */ - protected ArrayInstruction(short opcode) { - super(opcode, (short) 1); - } - - - public Class[] getExceptions() { - return org.apache.tomcat.util.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION; - } - - - /** @return type associated with the instruction - */ - public Type getType( ConstantPoolGen cp ) { - switch (opcode) { - case org.apache.tomcat.util.bcel.Constants.IALOAD: - case org.apache.tomcat.util.bcel.Constants.IASTORE: - return Type.INT; - case org.apache.tomcat.util.bcel.Constants.CALOAD: - case org.apache.tomcat.util.bcel.Constants.CASTORE: - return Type.CHAR; - case org.apache.tomcat.util.bcel.Constants.BALOAD: - case org.apache.tomcat.util.bcel.Constants.BASTORE: - return Type.BYTE; - case org.apache.tomcat.util.bcel.Constants.SALOAD: - case org.apache.tomcat.util.bcel.Constants.SASTORE: - return Type.SHORT; - case org.apache.tomcat.util.bcel.Constants.LALOAD: - case org.apache.tomcat.util.bcel.Constants.LASTORE: - return Type.LONG; - case org.apache.tomcat.util.bcel.Constants.DALOAD: - case org.apache.tomcat.util.bcel.Constants.DASTORE: - return Type.DOUBLE; - case org.apache.tomcat.util.bcel.Constants.FALOAD: - case org.apache.tomcat.util.bcel.Constants.FASTORE: - return Type.FLOAT; - case org.apache.tomcat.util.bcel.Constants.AALOAD: - case org.apache.tomcat.util.bcel.Constants.AASTORE: - return Type.OBJECT; - default: - throw new ClassGenException("Oops: unknown case in switch" + opcode); - } - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ArrayType.java b/java/org/apache/tomcat/util/bcel/generic/ArrayType.java index 58088a40d..36ab2ad17 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ArrayType.java +++ b/java/org/apache/tomcat/util/bcel/generic/ArrayType.java @@ -30,24 +30,10 @@ public final class ArrayType extends ReferenceType { private Type basic_type; - /** - * Convenience constructor for array type, e.g. int[] - * - * @param type array type, e.g. T_INT - */ - public ArrayType(byte type, int dimensions) { - this(BasicType.getType(type), dimensions); - } + - /** - * Convenience constructor for reference array type, e.g. Object[] - * - * @param class_name complete name of class (java.lang.String, e.g.) - */ - public ArrayType(String class_name, int dimensions) { - this(new ObjectType(class_name), dimensions); - } + /** @@ -82,30 +68,13 @@ public final class ArrayType extends ReferenceType { } - /** - * @return basic type of array, i.e., for int[][][] the basic type is int - */ - public Type getBasicType() { - return basic_type; - } + - /** - * @return element type of array, i.e., for int[][][] the element type is int[][] - */ - public Type getElementType() { - if (dimensions == 1) { - return basic_type; - } - return new ArrayType(basic_type, dimensions - 1); - } + - /** @return number of dimensions of array - */ - public int getDimensions() { - return dimensions; - } + /** @return a hash code value for the object. diff --git a/java/org/apache/tomcat/util/bcel/generic/BALOAD.java b/java/org/apache/tomcat/util/bcel/generic/BALOAD.java deleted file mode 100644 index 5351d8f25..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/BALOAD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * BALOAD - Load byte or boolean from array - *
Stack: ..., arrayref, index -> ..., value- * - * @version $Id$ - * @author M. Dahm - */ -public class BALOAD extends ArrayInstruction implements StackProducer { - - /** Load byte or boolean from array - */ - public BALOAD() { - super(org.apache.tomcat.util.bcel.Constants.BALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/BASTORE.java b/java/org/apache/tomcat/util/bcel/generic/BASTORE.java deleted file mode 100644 index 9b9238046..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/BASTORE.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * BASTORE - Store into byte or boolean array - *
Stack: ..., arrayref, index, value -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class BASTORE extends ArrayInstruction implements StackConsumer { - - /** Store byte or boolean into array - */ - public BASTORE() { - super(org.apache.tomcat.util.bcel.Constants.BASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java b/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java index dce4dcddb..125010ad5 100644 --- a/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java +++ b/java/org/apache/tomcat/util/bcel/generic/BIPUSH.java @@ -41,12 +41,7 @@ public class BIPUSH extends Instruction implements ConstantPushInstruction { } - /** Push byte on stack - */ - public BIPUSH(byte b) { - super(org.apache.tomcat.util.bcel.Constants.BIPUSH, (short) 2); - this.b = b; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java b/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java index bd436d952..f800bb443 100644 --- a/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java +++ b/java/org/apache/tomcat/util/bcel/generic/BranchHandle.java @@ -83,28 +83,13 @@ public final class BranchHandle extends InstructionHandle { } - /** - * Pass new target to instruction. - */ - public void setTarget( InstructionHandle ih ) { - bi.setTarget(ih); - } + - /** - * Update target of instruction. - */ - public void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih ) { - bi.updateTarget(old_ih, new_ih); - } + - /** - * @return target of instruction. - */ - public InstructionHandle getTarget() { - return bi.getTarget(); - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/CALOAD.java b/java/org/apache/tomcat/util/bcel/generic/CALOAD.java deleted file mode 100644 index 1152bea59..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/CALOAD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * CALOAD - Load char from array - *
Stack: ..., arrayref, index -> ..., value- * - * @version $Id$ - * @author M. Dahm - */ -public class CALOAD extends ArrayInstruction implements StackProducer { - - /** Load char from array - */ - public CALOAD() { - super(org.apache.tomcat.util.bcel.Constants.CALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/CASTORE.java b/java/org/apache/tomcat/util/bcel/generic/CASTORE.java deleted file mode 100644 index 56b82e02c..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/CASTORE.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * CASTORE - Store into char array - *
Stack: ..., arrayref, index, value -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class CASTORE extends ArrayInstruction implements StackConsumer { - - /** Store char into array - */ - public CASTORE() { - super(org.apache.tomcat.util.bcel.Constants.CASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java b/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java index 633c98030..b27395fbe 100644 --- a/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java +++ b/java/org/apache/tomcat/util/bcel/generic/CHECKCAST.java @@ -16,8 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * CHECKCAST - Check whether object is of given type *
Stack: ..., objectref -> ..., objectref@@ -36,30 +34,11 @@ public class CHECKCAST extends CPInstruction implements LoadClass, ExceptionThro } - /** Check whether object is of given type - * @param index index to class in constant pool - */ - public CHECKCAST(int index) { - super(org.apache.tomcat.util.bcel.Constants.CHECKCAST, index); - } + - /** @return exceptions this instruction may cause - */ - public Class[] getExceptions() { - Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); - cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.CLASS_CAST_EXCEPTION; - return cs; - } + - public ObjectType getLoadClassType( ConstantPoolGen cpg ) { - Type t = getType(cpg); - if (t instanceof ArrayType) { - t = ((ArrayType) t).getBasicType(); - } - return (t instanceof ObjectType) ? (ObjectType) t : null; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java b/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java index 0910815a1..58dd8eb0a 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/ClassElementValueGen.java @@ -6,7 +6,6 @@ import org.apache.tomcat.util.bcel.classfile.ElementValue; import org.apache.tomcat.util.bcel.classfile.ConstantUtf8; import org.apache.tomcat.util.bcel.classfile.ClassElementValue; import org.apache.tomcat.util.bcel.generic.ConstantPoolGen; -import org.apache.tomcat.util.bcel.generic.ObjectType; import org.apache.tomcat.util.bcel.generic.ElementValueGen; public class ClassElementValueGen extends ElementValueGen @@ -16,18 +15,9 @@ public class ClassElementValueGen extends ElementValueGen // For 'class' this points to the class entry in the cpool private int idx; - protected ClassElementValueGen(int typeIdx, ConstantPoolGen cpool) - { - super(ElementValueGen.CLASS, cpool); - this.idx = typeIdx; - } + - public ClassElementValueGen(ObjectType t, ConstantPoolGen cpool) - { - super(ElementValueGen.CLASS, cpool); - // this.idx = cpool.addClass(t); - idx = cpool.addUtf8(t.getSignature()); - } + /** * Return immutable variant of this ClassElementValueGen @@ -52,10 +42,7 @@ public class ClassElementValueGen extends ElementValueGen } } - public int getIndex() - { - return idx; - } + public String getClassString() { diff --git a/java/org/apache/tomcat/util/bcel/generic/ClassGen.java b/java/org/apache/tomcat/util/bcel/generic/ClassGen.java index e730ff947..130870a23 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ClassGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/ClassGen.java @@ -17,22 +17,11 @@ package org.apache.tomcat.util.bcel.generic; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.apache.tomcat.util.bcel.Constants; import org.apache.tomcat.util.bcel.classfile.AccessFlags; -import org.apache.tomcat.util.bcel.classfile.AnnotationEntry; -import org.apache.tomcat.util.bcel.classfile.Annotations; -import org.apache.tomcat.util.bcel.classfile.Attribute; -import org.apache.tomcat.util.bcel.classfile.ConstantPool; -import org.apache.tomcat.util.bcel.classfile.Field; import org.apache.tomcat.util.bcel.classfile.JavaClass; -import org.apache.tomcat.util.bcel.classfile.Method; -import org.apache.tomcat.util.bcel.classfile.RuntimeInvisibleAnnotations; -import org.apache.tomcat.util.bcel.classfile.RuntimeVisibleAnnotations; -import org.apache.tomcat.util.bcel.classfile.SourceFile; -import org.apache.tomcat.util.bcel.classfile.Utility; import org.apache.tomcat.util.bcel.util.BCELComparator; /** @@ -74,491 +63,84 @@ public class ClassGen extends AccessFlags implements Cloneable { }; - /** Convenience constructor to set up some important values initially. - * - * @param class_name fully qualified class name - * @param super_class_name fully qualified superclass name - * @param file_name source file name - * @param access_flags access qualifiers - * @param interfaces implemented interfaces - * @param cp constant pool to use - */ - public ClassGen(String class_name, String super_class_name, String file_name, int access_flags, - String[] interfaces, ConstantPoolGen cp) { - this.class_name = class_name; - this.super_class_name = super_class_name; - this.file_name = file_name; - this.access_flags = access_flags; - this.cp = cp; - // Put everything needed by default into the constant pool and the vectors - if (file_name != null) { - addAttribute(new SourceFile(cp.addUtf8("SourceFile"), 2, cp.addUtf8(file_name), cp - .getConstantPool())); - } - class_name_index = cp.addClass(class_name); - superclass_name_index = cp.addClass(super_class_name); - if (interfaces != null) { - for (int i = 0; i < interfaces.length; i++) { - addInterface(interfaces[i]); - } - } - } - - - /** Convenience constructor to set up some important values initially. - * - * @param class_name fully qualified class name - * @param super_class_name fully qualified superclass name - * @param file_name source file name - * @param access_flags access qualifiers - * @param interfaces implemented interfaces - */ - public ClassGen(String class_name, String super_class_name, String file_name, int access_flags, - String[] interfaces) { - this(class_name, super_class_name, file_name, access_flags, interfaces, - new ConstantPoolGen()); - } - - - /** - * Initialize with existing class. - * @param clazz JavaClass object (e.g. read from file) - */ - public ClassGen(JavaClass clazz) { - class_name_index = clazz.getClassNameIndex(); - superclass_name_index = clazz.getSuperclassNameIndex(); - class_name = clazz.getClassName(); - super_class_name = clazz.getSuperclassName(); - file_name = clazz.getSourceFileName(); - access_flags = clazz.getAccessFlags(); - cp = new ConstantPoolGen(clazz.getConstantPool()); - major = clazz.getMajor(); - minor = clazz.getMinor(); - Attribute[] attributes = clazz.getAttributes(); - // J5TODO: Could make unpacking lazy, done on first reference - AnnotationEntryGen[] annotations = unpackAnnotations(attributes); - Method[] methods = clazz.getMethods(); - Field[] fields = clazz.getFields(); - String[] interfaces = clazz.getInterfaceNames(); - for (int i = 0; i < interfaces.length; i++) { - addInterface(interfaces[i]); - } - for (int i = 0; i < attributes.length; i++) { - if (!(attributes[i] instanceof Annotations)) { - addAttribute(attributes[i]); - } - } - for(int i=0; i < annotations.length; i++) { - addAnnotationEntry(annotations[i]); - } - for (int i = 0; i < methods.length; i++) { - addMethod(methods[i]); - } - for (int i = 0; i < fields.length; i++) { - addField(fields[i]); - } - } - /** - * Look for attributes representing annotations and unpack them. - */ - private AnnotationEntryGen[] unpackAnnotations(Attribute[] attrs) - { - List /* AnnotationGen */annotationGenObjs = new ArrayList(); - for (int i = 0; i < attrs.length; i++) - { - Attribute attr = attrs[i]; - if (attr instanceof RuntimeVisibleAnnotations) - { - RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr; - AnnotationEntry[] annos = rva.getAnnotationEntries(); - for (int j = 0; j < annos.length; j++) - { - AnnotationEntry a = annos[j]; - annotationGenObjs.add(new AnnotationEntryGen(a, - getConstantPool(), false)); - } - } - else - if (attr instanceof RuntimeInvisibleAnnotations) - { - RuntimeInvisibleAnnotations ria = (RuntimeInvisibleAnnotations) attr; - AnnotationEntry[] annos = ria.getAnnotationEntries(); - for (int j = 0; j < annos.length; j++) - { - AnnotationEntry a = annos[j]; - annotationGenObjs.add(new AnnotationEntryGen(a, - getConstantPool(), false)); - } - } - } - return (AnnotationEntryGen[]) annotationGenObjs - .toArray(new AnnotationEntryGen[annotationGenObjs.size()]); - } - - - /** - * @return the (finally) built up Java class object. - */ - public JavaClass getJavaClass() { - int[] interfaces = getInterfaces(); - Field[] fields = getFields(); - Method[] methods = getMethods(); - Attribute[] attributes = null; - if (annotation_vec.isEmpty()) { - attributes = getAttributes(); - } else { - // TODO: Sometime later, trash any attributes called 'RuntimeVisibleAnnotations' or 'RuntimeInvisibleAnnotations' - Attribute[] annAttributes = Utility.getAnnotationAttributes(cp,annotation_vec); - attributes = new Attribute[attribute_vec.size()+annAttributes.length]; - attribute_vec.toArray(attributes); - System.arraycopy(annAttributes,0,attributes,attribute_vec.size(),annAttributes.length); - } - // Must be last since the above calls may still add something to it - ConstantPool _cp = this.cp.getFinalConstantPool(); - return new JavaClass(class_name_index, superclass_name_index, file_name, major, minor, - access_flags, _cp, interfaces, fields, methods, attributes); - } - - - /** - * Add an interface to this class, i.e., this class has to implement it. - * @param name interface to implement (fully qualified class name) - */ - public void addInterface( String name ) { - interface_vec.add(name); - } - - - /** - * Remove an interface from this class. - * @param name interface to remove (fully qualified name) - */ - public void removeInterface( String name ) { - interface_vec.remove(name); - } - - - /** - * @return major version number of class file - */ - public int getMajor() { - return major; - } - - - /** Set major version number of class file, default value is 45 (JDK 1.1) - * @param major major version number - */ - public void setMajor( int major ) { - this.major = major; - } - /** Set minor version number of class file, default value is 3 (JDK 1.1) - * @param minor minor version number - */ - public void setMinor( int minor ) { - this.minor = minor; - } - - - /** - * @return minor version number of class file - */ - public int getMinor() { - return minor; - } - - - /** - * Add an attribute to this class. - * @param a attribute to add - */ - public void addAttribute( Attribute a ) { - attribute_vec.add(a); - } - public void addAnnotationEntry(AnnotationEntryGen a) { - annotation_vec.add(a); - } - - - /** - * Add a method to this class. - * @param m method to add - */ - public void addMethod( Method m ) { - method_vec.add(m); - } - - - /** - * Convenience method. - * - * Add an empty constructor to this class that does nothing but calling super(). - * @param access_flags rights for constructor - */ - public void addEmptyConstructor( int access_flags ) { - InstructionList il = new InstructionList(); - il.append(InstructionConstants.THIS); // Push `this' - il.append(new INVOKESPECIAL(cp.addMethodref(super_class_name, "
Stack: ..., value.word1, value.word2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class D2F extends ConversionInstruction { - - /** Convert double to float - */ - public D2F() { - super(org.apache.tomcat.util.bcel.Constants.D2F); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/D2I.java b/java/org/apache/tomcat/util/bcel/generic/D2I.java deleted file mode 100644 index e02a82a27..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/D2I.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * D2I - Convert double to int - *
Stack: ..., value.word1, value.word2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class D2I extends ConversionInstruction { - - /** Convert double to int - */ - public D2I() { - super(org.apache.tomcat.util.bcel.Constants.D2I); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/D2L.java b/java/org/apache/tomcat/util/bcel/generic/D2L.java deleted file mode 100644 index 74c226add..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/D2L.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * D2L - Convert double to long - *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class D2L extends ConversionInstruction { - - /** Convert double to long - */ - public D2L() { - super(org.apache.tomcat.util.bcel.Constants.D2L); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DADD.java b/java/org/apache/tomcat/util/bcel/generic/DADD.java deleted file mode 100644 index cc9d191da..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DADD.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DADD - Add doubles - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result1.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class DADD extends ArithmeticInstruction { - - /** Add doubles - */ - public DADD() { - super(org.apache.tomcat.util.bcel.Constants.DADD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DALOAD.java b/java/org/apache/tomcat/util/bcel/generic/DALOAD.java deleted file mode 100644 index 61f47f609..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DALOAD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DALOAD - Load double from array - *
Stack: ..., arrayref, index -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class DALOAD extends ArrayInstruction implements StackProducer { - - /** Load double from array - */ - public DALOAD() { - super(org.apache.tomcat.util.bcel.Constants.DALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DASTORE.java b/java/org/apache/tomcat/util/bcel/generic/DASTORE.java deleted file mode 100644 index 0e28a7d0c..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DASTORE.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DASTORE - Store into double array - *
Stack: ..., arrayref, index, value.word1, value.word2 -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class DASTORE extends ArrayInstruction implements StackConsumer { - - /** Store double into array - */ - public DASTORE() { - super(org.apache.tomcat.util.bcel.Constants.DASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DCMPG.java b/java/org/apache/tomcat/util/bcel/generic/DCMPG.java deleted file mode 100644 index 246336217..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DCMPG.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DCMPG - Compare doubles: value1 > value2 - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result - * - * @version $Id$ - * @author M. Dahm - */ -public class DCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer { - - public DCMPG() { - super(org.apache.tomcat.util.bcel.Constants.DCMPG, (short) 1); - } - - - /** @return Type.DOUBLE - */ - public Type getType( ConstantPoolGen cp ) { - return Type.DOUBLE; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DCMPL.java b/java/org/apache/tomcat/util/bcel/generic/DCMPL.java deleted file mode 100644 index 2d33d4c86..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DCMPL.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DCMPL - Compare doubles: value1 < value2 - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result - * - * @version $Id$ - * @author M. Dahm - */ -public class DCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer { - - public DCMPL() { - super(org.apache.tomcat.util.bcel.Constants.DCMPL, (short) 1); - } - - - /** @return Type.DOUBLE - */ - public Type getType( ConstantPoolGen cp ) { - return Type.DOUBLE; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DCONST.java b/java/org/apache/tomcat/util/bcel/generic/DCONST.java deleted file mode 100644 index 26ac18f86..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DCONST.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DCONST - Push 0.0 or 1.0, other values cause an exception - * - *
Stack: ... -> ...,- * - * @version $Id$ - * @author M. Dahm - */ -public class DCONST extends Instruction implements ConstantPushInstruction, TypedInstruction { - - private double value; - - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - DCONST() { - } - - - public DCONST(double f) { - super(org.apache.tomcat.util.bcel.Constants.DCONST_0, (short) 1); - if (f == 0.0) { - opcode = org.apache.tomcat.util.bcel.Constants.DCONST_0; - } else if (f == 1.0) { - opcode = org.apache.tomcat.util.bcel.Constants.DCONST_1; - } else { - throw new ClassGenException("DCONST can be used only for 0.0 and 1.0: " + f); - } - value = f; - } - - - public Number getValue() { - return new Double(value); - } - - - /** @return Type.DOUBLE - */ - public Type getType( ConstantPoolGen cp ) { - return Type.DOUBLE; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DDIV.java b/java/org/apache/tomcat/util/bcel/generic/DDIV.java deleted file mode 100644 index 694602b39..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DDIV.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DDIV - Divide doubles - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class DDIV extends ArithmeticInstruction { - - /** Divide doubles - */ - public DDIV() { - super(org.apache.tomcat.util.bcel.Constants.DDIV); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DMUL.java b/java/org/apache/tomcat/util/bcel/generic/DMUL.java deleted file mode 100644 index f22523e59..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DMUL.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DMUL - Multiply doubles - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class DMUL extends ArithmeticInstruction { - - /** Multiply doubles - */ - public DMUL() { - super(org.apache.tomcat.util.bcel.Constants.DMUL); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DNEG.java b/java/org/apache/tomcat/util/bcel/generic/DNEG.java deleted file mode 100644 index eb59ac157..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DNEG.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DNEG - Negate double - *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class DNEG extends ArithmeticInstruction { - - public DNEG() { - super(org.apache.tomcat.util.bcel.Constants.DNEG); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DREM.java b/java/org/apache/tomcat/util/bcel/generic/DREM.java deleted file mode 100644 index 8b36690fc..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DREM.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DREM - Remainder of doubles - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class DREM extends ArithmeticInstruction { - - /** Remainder of doubles - */ - public DREM() { - super(org.apache.tomcat.util.bcel.Constants.DREM); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DRETURN.java b/java/org/apache/tomcat/util/bcel/generic/DRETURN.java deleted file mode 100644 index b78fe8311..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DRETURN.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DRETURN - Return double from method - *
Stack: ..., value.word1, value.word2 -> <empty>- * - * @version $Id$ - * @author M. Dahm - */ -public class DRETURN extends ReturnInstruction { - - /** Return double from method - */ - public DRETURN() { - super(org.apache.tomcat.util.bcel.Constants.DRETURN); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DSUB.java b/java/org/apache/tomcat/util/bcel/generic/DSUB.java deleted file mode 100644 index f020f3df1..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DSUB.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DSUB - Substract doubles - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class DSUB extends ArithmeticInstruction { - - /** Substract doubles - */ - public DSUB() { - super(org.apache.tomcat.util.bcel.Constants.DSUB); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DUP.java b/java/org/apache/tomcat/util/bcel/generic/DUP.java deleted file mode 100644 index 10967bb1b..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DUP.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DUP - Duplicate top operand stack word - *
Stack: ..., word -> ..., word, word- * - * @version $Id$ - * @author M. Dahm - */ -public class DUP extends StackInstruction implements PushInstruction { - - public DUP() { - super(org.apache.tomcat.util.bcel.Constants.DUP); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DUP2.java b/java/org/apache/tomcat/util/bcel/generic/DUP2.java deleted file mode 100644 index 16090aac8..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DUP2.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DUP2 - Duplicate two top operand stack words - *
Stack: ..., word2, word1 -> ..., word2, word1, word2, word1- * - * @version $Id$ - * @author M. Dahm - */ -public class DUP2 extends StackInstruction implements PushInstruction { - - public DUP2() { - super(org.apache.tomcat.util.bcel.Constants.DUP2); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DUP2_X1.java b/java/org/apache/tomcat/util/bcel/generic/DUP2_X1.java deleted file mode 100644 index 6309cad8c..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DUP2_X1.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DUP2_X1 - Duplicate two top operand stack words and put three down - *
Stack: ..., word3, word2, word1 -> ..., word2, word1, word3, word2, word1- * - * @version $Id$ - * @author M. Dahm - */ -public class DUP2_X1 extends StackInstruction { - - public DUP2_X1() { - super(org.apache.tomcat.util.bcel.Constants.DUP2_X1); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DUP2_X2.java b/java/org/apache/tomcat/util/bcel/generic/DUP2_X2.java deleted file mode 100644 index c528e0832..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DUP2_X2.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DUP2_X2 - Duplicate two top operand stack words and put four down - *
Stack: ..., word4, word3, word2, word1 -> ..., word2, word1, word4, word3, word2, word1- * - * @version $Id$ - * @author M. Dahm - */ -public class DUP2_X2 extends StackInstruction { - - public DUP2_X2() { - super(org.apache.tomcat.util.bcel.Constants.DUP2_X2); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DUP_X1.java b/java/org/apache/tomcat/util/bcel/generic/DUP_X1.java deleted file mode 100644 index c33f725a5..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DUP_X1.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DUP_X1 - Duplicate top operand stack word and put two down - *
Stack: ..., word2, word1 -> ..., word1, word2, word1- * - * @version $Id$ - * @author M. Dahm - */ -public class DUP_X1 extends StackInstruction { - - public DUP_X1() { - super(org.apache.tomcat.util.bcel.Constants.DUP_X1); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/DUP_X2.java b/java/org/apache/tomcat/util/bcel/generic/DUP_X2.java deleted file mode 100644 index 255ea2615..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/DUP_X2.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * DUP_X2 - Duplicate top operand stack word and put three down - *
Stack: ..., word3, word2, word1 -> ..., word1, word3, word2, word1- * - * @version $Id$ - * @author M. Dahm - */ -public class DUP_X2 extends StackInstruction { - - public DUP_X2() { - super(org.apache.tomcat.util.bcel.Constants.DUP_X2); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java b/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java index 63e416c65..26979f038 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/ElementValueGen.java @@ -1,11 +1,9 @@ package org.apache.tomcat.util.bcel.generic; -import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import org.apache.tomcat.util.bcel.classfile.AnnotationElementValue; -import org.apache.tomcat.util.bcel.classfile.AnnotationEntry; import org.apache.tomcat.util.bcel.classfile.ArrayElementValue; import org.apache.tomcat.util.bcel.classfile.ClassElementValue; import org.apache.tomcat.util.bcel.classfile.ElementValue; @@ -29,10 +27,7 @@ public abstract class ElementValueGen */ public abstract ElementValue getElementValue(); - public int getElementValueType() - { - return type; - } + public abstract String stringifyValue(); @@ -64,64 +59,7 @@ public abstract class ElementValueGen public static final int PRIMITIVE_BOOLEAN = 'Z'; - public static ElementValueGen readElementValue(DataInputStream dis, - ConstantPoolGen cpGen) throws IOException - { - int type = dis.readUnsignedByte(); - switch (type) - { - case 'B': // byte - return new SimpleElementValueGen(PRIMITIVE_BYTE, dis - .readUnsignedShort(), cpGen); - case 'C': // char - return new SimpleElementValueGen(PRIMITIVE_CHAR, dis - .readUnsignedShort(), cpGen); - case 'D': // double - return new SimpleElementValueGen(PRIMITIVE_DOUBLE, dis - .readUnsignedShort(), cpGen); - case 'F': // float - return new SimpleElementValueGen(PRIMITIVE_FLOAT, dis - .readUnsignedShort(), cpGen); - case 'I': // int - return new SimpleElementValueGen(PRIMITIVE_INT, dis - .readUnsignedShort(), cpGen); - case 'J': // long - return new SimpleElementValueGen(PRIMITIVE_LONG, dis - .readUnsignedShort(), cpGen); - case 'S': // short - return new SimpleElementValueGen(PRIMITIVE_SHORT, dis - .readUnsignedShort(), cpGen); - case 'Z': // boolean - return new SimpleElementValueGen(PRIMITIVE_BOOLEAN, dis - .readUnsignedShort(), cpGen); - case 's': // String - return new SimpleElementValueGen(STRING, dis.readUnsignedShort(), - cpGen); - case 'e': // Enum constant - return new EnumElementValueGen(dis.readUnsignedShort(), dis - .readUnsignedShort(), cpGen); - case 'c': // Class - return new ClassElementValueGen(dis.readUnsignedShort(), cpGen); - case '@': // Annotation - // TODO: isRuntimeVisible ?????????? - // FIXME - return new AnnotationElementValueGen(ANNOTATION, - new AnnotationEntryGen(AnnotationEntry.read(dis, cpGen - .getConstantPool(), true), cpGen, false), cpGen); - case '[': // Array - int numArrayVals = dis.readUnsignedShort(); - ElementValue[] evalues = new ElementValue[numArrayVals]; - for (int j = 0; j < numArrayVals; j++) - { - evalues[j] = ElementValue.readElementValue(dis, cpGen - .getConstantPool()); - } - return new ArrayElementValueGen(ARRAY, evalues, cpGen); - default: - throw new RuntimeException( - "Unexpected element value kind in annotation: " + type); - } - } + protected ConstantPoolGen getConstantPool() { diff --git a/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java b/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java index 590c10c84..4c40c0c51 100755 --- a/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/ElementValuePairGen.java @@ -47,21 +47,9 @@ public class ElementValuePairGen .getConstantPool()); } - protected ElementValuePairGen(int idx, ElementValueGen value, - ConstantPoolGen cpool) - { - this.nameIdx = idx; - this.value = value; - this.cpool = cpool; - } + - public ElementValuePairGen(String name, ElementValueGen value, - ConstantPoolGen cpool) - { - this.nameIdx = cpool.addUtf8(name); - this.value = value; - this.cpool = cpool; - } + protected void dump(DataOutputStream dos) throws IOException { @@ -69,10 +57,7 @@ public class ElementValuePairGen value.dump(dos); } - public int getNameIndex() - { - return nameIdx; - } + public final String getNameString() { @@ -80,10 +65,7 @@ public class ElementValuePairGen return ((ConstantUtf8) cpool.getConstant(nameIdx)).getBytes(); } - public final ElementValueGen getValue() - { - return value; - } + public String toString() { diff --git a/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java b/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java index 2e78d1e78..afeab8349 100644 --- a/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/EnumElementValueGen.java @@ -13,21 +13,7 @@ public class EnumElementValueGen extends ElementValueGen private int valueIdx; - /** - * This ctor assumes the constant pool already contains the right type and - * value - as indicated by typeIdx and valueIdx. This ctor is used for - * deserialization - */ - protected EnumElementValueGen(int typeIdx, int valueIdx, - ConstantPoolGen cpool) - { - super(ElementValueGen.ENUM_CONSTANT, cpool); - if (type != ENUM_CONSTANT) - throw new RuntimeException( - "Only element values of type enum can be built with this ctor - type specified: " + type); - this.typeIdx = typeIdx; - this.valueIdx = valueIdx; - } + /** * Return immutable variant of this EnumElementValue @@ -40,12 +26,7 @@ public class EnumElementValueGen extends ElementValueGen .getConstantPool()); } - public EnumElementValueGen(ObjectType t, String value, ConstantPoolGen cpool) - { - super(ElementValueGen.ENUM_CONSTANT, cpool); - typeIdx = cpool.addUtf8(t.getSignature());// was addClass(t); - valueIdx = cpool.addUtf8(value);// was addString(value); - } + public EnumElementValueGen(EnumElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries) @@ -107,13 +88,7 @@ public class EnumElementValueGen extends ElementValueGen // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes(); } - public int getValueIndex() - { - return valueIdx; - } + - public int getTypeIndex() - { - return typeIdx; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java b/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java index f62cca0c1..b13ab0618 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java +++ b/java/org/apache/tomcat/util/bcel/generic/ExceptionThrower.java @@ -38,5 +38,5 @@ package org.apache.tomcat.util.bcel.generic; */ public interface ExceptionThrower { - public java.lang.Class[] getExceptions(); + } diff --git a/java/org/apache/tomcat/util/bcel/generic/F2D.java b/java/org/apache/tomcat/util/bcel/generic/F2D.java deleted file mode 100644 index 4bcaeaf03..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/F2D.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * F2D - Convert float to double - *
Stack: ..., value -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class F2D extends ConversionInstruction { - - /** Convert float to double - */ - public F2D() { - super(org.apache.tomcat.util.bcel.Constants.F2D); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/F2I.java b/java/org/apache/tomcat/util/bcel/generic/F2I.java deleted file mode 100644 index f3199ebe7..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/F2I.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * F2I - Convert float to int - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class F2I extends ConversionInstruction { - - /** Convert float to int - */ - public F2I() { - super(org.apache.tomcat.util.bcel.Constants.F2I); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/F2L.java b/java/org/apache/tomcat/util/bcel/generic/F2L.java deleted file mode 100644 index c3f1ee5ea..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/F2L.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * F2L - Convert float to long - *
Stack: ..., value -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class F2L extends ConversionInstruction { - - /** Convert float to long - */ - public F2L() { - super(org.apache.tomcat.util.bcel.Constants.F2L); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FADD.java b/java/org/apache/tomcat/util/bcel/generic/FADD.java deleted file mode 100644 index a56fde961..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FADD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FADD - Add floats - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class FADD extends ArithmeticInstruction { - - /** Add floats - */ - public FADD() { - super(org.apache.tomcat.util.bcel.Constants.FADD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FALOAD.java b/java/org/apache/tomcat/util/bcel/generic/FALOAD.java deleted file mode 100644 index 45b4d64af..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FALOAD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FALOAD - Load float from array - *
Stack: ..., arrayref, index -> ..., value- * - * @version $Id$ - * @author M. Dahm - */ -public class FALOAD extends ArrayInstruction implements StackProducer { - - /** Load float from array - */ - public FALOAD() { - super(org.apache.tomcat.util.bcel.Constants.FALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FASTORE.java b/java/org/apache/tomcat/util/bcel/generic/FASTORE.java deleted file mode 100644 index 7f8b33089..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FASTORE.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FASTORE - Store into float array - *
Stack: ..., arrayref, index, value -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class FASTORE extends ArrayInstruction implements StackConsumer { - - /** Store float into array - */ - public FASTORE() { - super(org.apache.tomcat.util.bcel.Constants.FASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FCMPG.java b/java/org/apache/tomcat/util/bcel/generic/FCMPG.java deleted file mode 100644 index 2ae4b36ca..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FCMPG.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FCMPG - Compare floats: value1 > value2 - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class FCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer { - - public FCMPG() { - super(org.apache.tomcat.util.bcel.Constants.FCMPG, (short) 1); - } - - - /** @return Type.FLOAT - */ - public Type getType( ConstantPoolGen cp ) { - return Type.FLOAT; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FCMPL.java b/java/org/apache/tomcat/util/bcel/generic/FCMPL.java deleted file mode 100644 index 341523674..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FCMPL.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FCMPL - Compare floats: value1 < value2 - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class FCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer { - - public FCMPL() { - super(org.apache.tomcat.util.bcel.Constants.FCMPL, (short) 1); - } - - - /** @return Type.FLOAT - */ - public Type getType( ConstantPoolGen cp ) { - return Type.FLOAT; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FCONST.java b/java/org/apache/tomcat/util/bcel/generic/FCONST.java deleted file mode 100644 index c8c08c2a1..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FCONST.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FCONST - Push 0.0, 1.0 or 2.0, other values cause an exception - * - *
Stack: ... -> ...,- * - * @version $Id$ - * @author M. Dahm - */ -public class FCONST extends Instruction implements ConstantPushInstruction, TypedInstruction { - - private float value; - - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - FCONST() { - } - - - public FCONST(float f) { - super(org.apache.tomcat.util.bcel.Constants.FCONST_0, (short) 1); - if (f == 0.0) { - opcode = org.apache.tomcat.util.bcel.Constants.FCONST_0; - } else if (f == 1.0) { - opcode = org.apache.tomcat.util.bcel.Constants.FCONST_1; - } else if (f == 2.0) { - opcode = org.apache.tomcat.util.bcel.Constants.FCONST_2; - } else { - throw new ClassGenException("FCONST can be used only for 0.0, 1.0 and 2.0: " + f); - } - value = f; - } - - - public Number getValue() { - return new Float(value); - } - - - /** @return Type.FLOAT - */ - public Type getType( ConstantPoolGen cp ) { - return Type.FLOAT; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FDIV.java b/java/org/apache/tomcat/util/bcel/generic/FDIV.java deleted file mode 100644 index 6e05a41b5..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FDIV.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FDIV - Divide floats - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class FDIV extends ArithmeticInstruction { - - /** Divide floats - */ - public FDIV() { - super(org.apache.tomcat.util.bcel.Constants.FDIV); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FMUL.java b/java/org/apache/tomcat/util/bcel/generic/FMUL.java deleted file mode 100644 index cfef64c68..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FMUL.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FMUL - Multiply floats - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class FMUL extends ArithmeticInstruction { - - /** Multiply floats - */ - public FMUL() { - super(org.apache.tomcat.util.bcel.Constants.FMUL); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FNEG.java b/java/org/apache/tomcat/util/bcel/generic/FNEG.java deleted file mode 100644 index 6ca99100f..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FNEG.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FNEG - Negate float - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class FNEG extends ArithmeticInstruction { - - public FNEG() { - super(org.apache.tomcat.util.bcel.Constants.FNEG); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FREM.java b/java/org/apache/tomcat/util/bcel/generic/FREM.java deleted file mode 100644 index d13011fbc..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FREM.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FREM - Remainder of floats - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class FREM extends ArithmeticInstruction { - - /** Remainder of floats - */ - public FREM() { - super(org.apache.tomcat.util.bcel.Constants.FREM); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FRETURN.java b/java/org/apache/tomcat/util/bcel/generic/FRETURN.java deleted file mode 100644 index ecbf2d5cc..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FRETURN.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FRETURN - Return float from method - *
Stack: ..., value -> <empty>- * - * @version $Id$ - * @author M. Dahm - */ -public class FRETURN extends ReturnInstruction { - - /** Return float from method - */ - public FRETURN() { - super(org.apache.tomcat.util.bcel.Constants.FRETURN); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FSUB.java b/java/org/apache/tomcat/util/bcel/generic/FSUB.java deleted file mode 100644 index 3fc84c2bd..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FSUB.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * FSUB - Substract floats - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class FSUB extends ArithmeticInstruction { - - /** Substract floats - */ - public FSUB() { - super(org.apache.tomcat.util.bcel.Constants.FSUB); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FieldGen.java b/java/org/apache/tomcat/util/bcel/generic/FieldGen.java index 325399b70..79491c5bd 100644 --- a/java/org/apache/tomcat/util/bcel/generic/FieldGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/FieldGen.java @@ -16,17 +16,7 @@ */ package org.apache.tomcat.util.bcel.generic; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.classfile.AnnotationEntry; -import org.apache.tomcat.util.bcel.classfile.Annotations; -import org.apache.tomcat.util.bcel.classfile.Attribute; -import org.apache.tomcat.util.bcel.classfile.Constant; -import org.apache.tomcat.util.bcel.classfile.ConstantObject; -import org.apache.tomcat.util.bcel.classfile.ConstantPool; -import org.apache.tomcat.util.bcel.classfile.ConstantValue; import org.apache.tomcat.util.bcel.classfile.Field; import org.apache.tomcat.util.bcel.classfile.Utility; import org.apache.tomcat.util.bcel.util.BCELComparator; @@ -60,199 +50,10 @@ public class FieldGen extends FieldGenOrMethodGen { }; - /** - * Declare a field. If it is static (isStatic() == true) and has a - * basic type like int or String it may have an initial value - * associated with it as defined by setInitValue(). - * - * @param access_flags access qualifiers - * @param type field type - * @param name field name - * @param cp constant pool - */ - public FieldGen(int access_flags, Type type, String name, ConstantPoolGen cp) { - setAccessFlags(access_flags); - setType(type); - setName(name); - setConstantPool(cp); - } - - - /** - * Instantiate from existing field. - * - * @param field Field object - * @param cp constant pool (must contain the same entries as the field's constant pool) - */ - public FieldGen(Field field, ConstantPoolGen cp) { - this(field.getAccessFlags(), Type.getType(field.getSignature()), field.getName(), cp); - Attribute[] attrs = field.getAttributes(); - for (int i = 0; i < attrs.length; i++) { - if (attrs[i] instanceof ConstantValue) { - setValue(((ConstantValue) attrs[i]).getConstantValueIndex()); - } else if (attrs[i] instanceof Annotations) { - Annotations runtimeAnnotations = (Annotations)attrs[i]; - AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries(); - for (int j = 0; j < annotationEntries.length; j++) { - AnnotationEntry element = annotationEntries[j]; - addAnnotationEntry(new AnnotationEntryGen(element,cp,false)); - } - } else { - addAttribute(attrs[i]); - } - } - } - - - private void setValue( int index ) { - ConstantPool cp = this.cp.getConstantPool(); - Constant c = cp.getConstant(index); - value = ((ConstantObject) c).getConstantValue(cp); - } - - - /** - * Set (optional) initial value of field, otherwise it will be set to null/0/false - * by the JVM automatically. - */ - public void setInitValue( String str ) { - checkType(new ObjectType("java.lang.String")); - if (str != null) { - value = str; - } - } - - - public void setInitValue( long l ) { - checkType(Type.LONG); - if (l != 0L) { - value = new Long(l); - } - } - - - public void setInitValue( int i ) { - checkType(Type.INT); - if (i != 0) { - value = new Integer(i); - } - } - - - public void setInitValue( short s ) { - checkType(Type.SHORT); - if (s != 0) { - value = new Integer(s); - } - } - - - public void setInitValue( char c ) { - checkType(Type.CHAR); - if (c != 0) { - value = new Integer(c); - } - } - - - public void setInitValue( byte b ) { - checkType(Type.BYTE); - if (b != 0) { - value = new Integer(b); - } - } - - - public void setInitValue( boolean b ) { - checkType(Type.BOOLEAN); - if (b) { - value = new Integer(1); - } - } - - - public void setInitValue( float f ) { - checkType(Type.FLOAT); - if (f != 0.0) { - value = new Float(f); - } - } - - - public void setInitValue( double d ) { - checkType(Type.DOUBLE); - if (d != 0.0) { - value = new Double(d); - } - } - - - /** Remove any initial value. - */ - public void cancelInitValue() { - value = null; - } - - - private void checkType( Type atype ) { - if (type == null) { - throw new ClassGenException("You haven't defined the type of the field yet"); - } - if (!isFinal()) { - throw new ClassGenException("Only final fields may have an initial value!"); - } - if (!type.equals(atype)) { - throw new ClassGenException("Types are not compatible: " + type + " vs. " + atype); - } - } + - /** - * Get field object after having set up all necessary values. - */ - public Field getField() { - String signature = getSignature(); - int name_index = cp.addUtf8(name); - int signature_index = cp.addUtf8(signature); - if (value != null) { - checkType(type); - int index = addConstant(); - addAttribute(new ConstantValue(cp.addUtf8("ConstantValue"), 2, index, cp - .getConstantPool())); - } - addAnnotationsAsAttribute(cp); - return new Field(access_flags, name_index, signature_index, getAttributes(), cp - .getConstantPool()); - } - private void addAnnotationsAsAttribute(ConstantPoolGen cp) { - Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec); - for (int i = 0; i < attrs.length; i++) { - addAttribute(attrs[i]); - } - } - - - private int addConstant() { - switch (type.getType()) { - case Constants.T_INT: - case Constants.T_CHAR: - case Constants.T_BYTE: - case Constants.T_BOOLEAN: - case Constants.T_SHORT: - return cp.addInteger(((Integer) value).intValue()); - case Constants.T_FLOAT: - return cp.addFloat(((Float) value).floatValue()); - case Constants.T_DOUBLE: - return cp.addDouble(((Double) value).doubleValue()); - case Constants.T_LONG: - return cp.addLong(((Long) value).longValue()); - case Constants.T_REFERENCE: - return cp.addString(((String) value)); - default: - throw new RuntimeException("Oops: Unhandled : " + type.getType()); - } - } public String getSignature() { @@ -262,36 +63,13 @@ public class FieldGen extends FieldGenOrMethodGen { private List observers; - /** Add observer for this object. - */ - public void addObserver( FieldObserver o ) { - if (observers == null) { - observers = new ArrayList(); - } - observers.add(o); - } + - /** Remove observer for this object. - */ - public void removeObserver( FieldObserver o ) { - if (observers != null) { - observers.remove(o); - } - } + - /** Call notify() method on all observers. This method is not called - * automatically whenever the state has changed, but has to be - * called by the user after he has finished editing the object. - */ - public void update() { - if (observers != null) { - for (Iterator e = observers.iterator(); e.hasNext();) { - ((FieldObserver) e.next()).notify(this); - } - } - } + public String getInitValue() { @@ -325,29 +103,13 @@ public class FieldGen extends FieldGenOrMethodGen { } - /** @return deep copy of this field - */ - public FieldGen copy( ConstantPoolGen cp ) { - FieldGen fg = (FieldGen) clone(); - fg.setConstantPool(cp); - return fg; - } + - /** - * @return Comparison strategy object - */ - public static BCELComparator getComparator() { - return _cmp; - } + - /** - * @param comparator Comparison strategy object - */ - public static void setComparator( BCELComparator comparator ) { - _cmp = comparator; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java b/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java index f8c1e71c5..edf89e997 100644 --- a/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/FieldGenOrMethodGen.java @@ -50,9 +50,7 @@ public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAn } - public Type getType() { - return type; - } + /** @return name of method/field. @@ -67,9 +65,7 @@ public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAn } - public ConstantPoolGen getConstantPool() { - return cp; - } + public void setConstantPool( ConstantPoolGen cp ) { @@ -89,36 +85,17 @@ public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAn attribute_vec.add(a); } - public void addAnnotationEntry(AnnotationEntryGen ag) - { - annotation_vec.add(ag); - } + - /** - * Remove an attribute. - */ - public void removeAttribute( Attribute a ) { - attribute_vec.remove(a); - } - public void removeAnnotationEntry(AnnotationEntryGen ag) - { - annotation_vec.remove(ag); - } + + - /** - * Remove all attributes. - */ - public void removeAttributes() { - attribute_vec.clear(); - } - public void removeAnnotationEntries() - { - annotation_vec.clear(); - } + + /** @@ -130,11 +107,7 @@ public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAn return attributes; } - public AnnotationEntryGen[] getAnnotationEntries() { - AnnotationEntryGen[] annotations = new AnnotationEntryGen[annotation_vec.size()]; - annotation_vec.toArray(annotations); - return annotations; - } + /** @return signature of method/field. diff --git a/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java b/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java index b3a8707b3..f32325c4e 100644 --- a/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java +++ b/java/org/apache/tomcat/util/bcel/generic/FieldInstruction.java @@ -34,12 +34,7 @@ public abstract class FieldInstruction extends FieldOrMethod implements TypedIns } - /** - * @param index to constant pool - */ - protected FieldInstruction(short opcode, int index) { - super(opcode, index); - } + /** @@ -72,9 +67,5 @@ public abstract class FieldInstruction extends FieldOrMethod implements TypedIns } - /** @return name of referenced field. - */ - public String getFieldName( ConstantPoolGen cpg ) { - return getName(cpg); - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/FieldObserver.java b/java/org/apache/tomcat/util/bcel/generic/FieldObserver.java deleted file mode 100644 index da42468e0..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/FieldObserver.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * Imnplement this interface if you're interested in changes to a FieldGen object - * and register yourself with addObserver(). - * - * @version $Id$ - * @author M. Dahm - */ -public interface FieldObserver { - - public void notify( FieldGen field ); -} diff --git a/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java b/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java index 01d3b9533..8322e0375 100644 --- a/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java +++ b/java/org/apache/tomcat/util/bcel/generic/FieldOrMethod.java @@ -38,12 +38,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { } - /** - * @param index to constant pool - */ - protected FieldOrMethod(short opcode, int index) { - super(opcode, index); - } + /** @return signature of referenced method/field. @@ -56,14 +51,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { } - /** @return name of referenced method/field. - */ - public String getName( ConstantPoolGen cpg ) { - ConstantPool cp = cpg.getConstantPool(); - ConstantCP cmr = (ConstantCP) cp.getConstant(index); - ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex()); - return ((ConstantUtf8) cp.getConstant(cnat.getNameIndex())).getBytes(); - } + /** @return name of the referenced class/interface @@ -88,41 +76,11 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { } - /** @return type of the referenced class/interface - * @deprecated If the instruction references an array class, - * the ObjectType returned will be invalid. Use - * getReferenceType() instead. - */ - public ObjectType getClassType( ConstantPoolGen cpg ) { - return new ObjectType(getClassName(cpg)); - } + - /** - * Return the reference type representing the class, interface, - * or array class referenced by the instruction. - * @param cpg the ConstantPoolGen used to create the instruction - * @return an ObjectType (if the referenced class type is a class - * or interface), or an ArrayType (if the referenced class - * type is an array class) - */ - public ReferenceType getReferenceType( ConstantPoolGen cpg ) { - ConstantPool cp = cpg.getConstantPool(); - ConstantCP cmr = (ConstantCP) cp.getConstant(index); - String className = cp.getConstantString(cmr.getClassIndex(), - org.apache.tomcat.util.bcel.Constants.CONSTANT_Class); - if (className.startsWith("[")) { - return (ArrayType) Type.getType(className); - } else { - className = className.replace('/', '.'); - return new ObjectType(className); - } - } + - /** @return type of the referenced class/interface - */ - public ObjectType getLoadClassType( ConstantPoolGen cpg ) { - return getClassType(cpg); - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/GETFIELD.java b/java/org/apache/tomcat/util/bcel/generic/GETFIELD.java index ae5f91384..1e69c394e 100644 --- a/java/org/apache/tomcat/util/bcel/generic/GETFIELD.java +++ b/java/org/apache/tomcat/util/bcel/generic/GETFIELD.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * GETFIELD - Fetch field from object *
Stack: ..., objectref -> ..., value@@ -39,9 +36,7 @@ public class GETFIELD extends FieldInstruction implements ExceptionThrower, Stac } - public GETFIELD(int index) { - super(Constants.GETFIELD, index); - } + public int produceStack( ConstantPoolGen cpg ) { @@ -49,12 +44,5 @@ public class GETFIELD extends FieldInstruction implements ExceptionThrower, Stac } - public Class[] getExceptions() { - Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/GETSTATIC.java b/java/org/apache/tomcat/util/bcel/generic/GETSTATIC.java index b7738aeec..3730797ec 100644 --- a/java/org/apache/tomcat/util/bcel/generic/GETSTATIC.java +++ b/java/org/apache/tomcat/util/bcel/generic/GETSTATIC.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * GETSTATIC - Fetch static field from class *
Stack: ..., -> ..., value@@ -38,9 +35,7 @@ public class GETSTATIC extends FieldInstruction implements PushInstruction, Exce } - public GETSTATIC(int index) { - super(Constants.GETSTATIC, index); - } + public int produceStack( ConstantPoolGen cpg ) { @@ -48,11 +43,5 @@ public class GETSTATIC extends FieldInstruction implements PushInstruction, Exce } - public Class[] getExceptions() { - Class[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/GOTO.java b/java/org/apache/tomcat/util/bcel/generic/GOTO.java index 275a5f940..082265f58 100644 --- a/java/org/apache/tomcat/util/bcel/generic/GOTO.java +++ b/java/org/apache/tomcat/util/bcel/generic/GOTO.java @@ -35,9 +35,7 @@ public class GOTO extends GotoInstruction implements VariableLengthInstruction { } - public GOTO(InstructionHandle target) { - super(org.apache.tomcat.util.bcel.Constants.GOTO, target); - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/GOTO_W.java b/java/org/apache/tomcat/util/bcel/generic/GOTO_W.java index b7546cf81..c678f32ca 100644 --- a/java/org/apache/tomcat/util/bcel/generic/GOTO_W.java +++ b/java/org/apache/tomcat/util/bcel/generic/GOTO_W.java @@ -36,10 +36,7 @@ public class GOTO_W extends GotoInstruction { } - public GOTO_W(InstructionHandle target) { - super(org.apache.tomcat.util.bcel.Constants.GOTO_W, target); - length = 5; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/GotoInstruction.java b/java/org/apache/tomcat/util/bcel/generic/GotoInstruction.java index cd82eab5d..53a7a7601 100644 --- a/java/org/apache/tomcat/util/bcel/generic/GotoInstruction.java +++ b/java/org/apache/tomcat/util/bcel/generic/GotoInstruction.java @@ -24,9 +24,7 @@ package org.apache.tomcat.util.bcel.generic; */ public abstract class GotoInstruction extends BranchInstruction implements UnconditionalBranch { - GotoInstruction(short opcode, InstructionHandle target) { - super(opcode, target); - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/I2B.java b/java/org/apache/tomcat/util/bcel/generic/I2B.java deleted file mode 100644 index e463733f9..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/I2B.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * I2B - Convert int to byte - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class I2B extends ConversionInstruction { - - /** Convert int to byte - */ - public I2B() { - super(org.apache.tomcat.util.bcel.Constants.I2B); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/I2C.java b/java/org/apache/tomcat/util/bcel/generic/I2C.java deleted file mode 100644 index 45b35b4b1..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/I2C.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * I2C - Convert int to char - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class I2C extends ConversionInstruction { - - /** Convert int to char - */ - public I2C() { - super(org.apache.tomcat.util.bcel.Constants.I2C); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/I2D.java b/java/org/apache/tomcat/util/bcel/generic/I2D.java deleted file mode 100644 index 354a9dfb4..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/I2D.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * I2D - Convert int to double - *
Stack: ..., value -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class I2D extends ConversionInstruction { - - /** Convert int to double - */ - public I2D() { - super(org.apache.tomcat.util.bcel.Constants.I2D); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/I2F.java b/java/org/apache/tomcat/util/bcel/generic/I2F.java deleted file mode 100644 index 08415e518..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/I2F.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * I2F - Convert int to float - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class I2F extends ConversionInstruction { - - /** Convert int to float - */ - public I2F() { - super(org.apache.tomcat.util.bcel.Constants.I2F); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/I2L.java b/java/org/apache/tomcat/util/bcel/generic/I2L.java deleted file mode 100644 index 1f77f4e9d..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/I2L.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * I2L - Convert int to long - *
Stack: ..., value -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class I2L extends ConversionInstruction { - - /** Convert int to long - */ - public I2L() { - super(org.apache.tomcat.util.bcel.Constants.I2L); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/I2S.java b/java/org/apache/tomcat/util/bcel/generic/I2S.java deleted file mode 100644 index 48a476933..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/I2S.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * I2S - Convert int to short - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class I2S extends ConversionInstruction { - - public I2S() { - super(org.apache.tomcat.util.bcel.Constants.I2S); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IADD.java b/java/org/apache/tomcat/util/bcel/generic/IADD.java deleted file mode 100644 index 1b02a92ea..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IADD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IADD - Add ints - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class IADD extends ArithmeticInstruction { - - /** Add ints - */ - public IADD() { - super(org.apache.tomcat.util.bcel.Constants.IADD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IALOAD.java b/java/org/apache/tomcat/util/bcel/generic/IALOAD.java deleted file mode 100644 index c07ad8f69..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IALOAD.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IALOAD - Load int from array - *
Stack: ..., arrayref, index -> ..., value- * - * @version $Id$ - * @author M. Dahm - */ -public class IALOAD extends ArrayInstruction implements StackProducer { - - /** - * Load int from array - */ - public IALOAD() { - super(org.apache.tomcat.util.bcel.Constants.IALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IAND.java b/java/org/apache/tomcat/util/bcel/generic/IAND.java deleted file mode 100644 index fae85c76b..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IAND.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IAND - Bitwise AND int - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class IAND extends ArithmeticInstruction { - - public IAND() { - super(org.apache.tomcat.util.bcel.Constants.IAND); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IASTORE.java b/java/org/apache/tomcat/util/bcel/generic/IASTORE.java deleted file mode 100644 index 860d7ed6a..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IASTORE.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IASTORE - Store into int array - *
Stack: ..., arrayref, index, value -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class IASTORE extends ArrayInstruction implements StackConsumer { - - /** - * Store into int array - */ - public IASTORE() { - super(org.apache.tomcat.util.bcel.Constants.IASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ICONST.java b/java/org/apache/tomcat/util/bcel/generic/ICONST.java deleted file mode 100644 index ad75d294a..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ICONST.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ICONST - Push value between -1, ..., 5, other values cause an exception - * - *
Stack: ... -> ...,- * - * @version $Id$ - * @author M. Dahm - */ -public class ICONST extends Instruction implements ConstantPushInstruction, TypedInstruction { - - private int value; - - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - ICONST() { - } - - - public ICONST(int i) { - super(org.apache.tomcat.util.bcel.Constants.ICONST_0, (short) 1); - if ((i >= -1) && (i <= 5)) { - opcode = (short) (org.apache.tomcat.util.bcel.Constants.ICONST_0 + i); // Even works for i == -1 - } else { - throw new ClassGenException("ICONST can be used only for value between -1 and 5: " + i); - } - value = i; - } - - - public Number getValue() { - return new Integer(value); - } - - - /** @return Type.INT - */ - public Type getType( ConstantPoolGen cp ) { - return Type.INT; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IDIV.java b/java/org/apache/tomcat/util/bcel/generic/IDIV.java deleted file mode 100644 index 7fb1b07ea..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IDIV.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IDIV - Divide ints - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class IDIV extends ArithmeticInstruction implements ExceptionThrower { - - /** Divide ints - */ - public IDIV() { - super(org.apache.tomcat.util.bcel.Constants.IDIV); - } - - - /** @return exceptions this instruction may cause - */ - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IINC.java b/java/org/apache/tomcat/util/bcel/generic/IINC.java index cba2ebf4c..b152d50be 100644 --- a/java/org/apache/tomcat/util/bcel/generic/IINC.java +++ b/java/org/apache/tomcat/util/bcel/generic/IINC.java @@ -40,17 +40,7 @@ public class IINC extends LocalVariableInstruction { } - /** - * @param n index of local variable - * @param c increment factor - */ - public IINC(int n, int c) { - super(); // Default behaviour of LocalVariableInstruction causes error - this.opcode = org.apache.tomcat.util.bcel.Constants.IINC; - this.length = (short) 3; - setIndex(n); // May set wide as side effect - setIncrement(c); - } + /** @@ -119,21 +109,10 @@ public class IINC extends LocalVariableInstruction { } - /** - * @return increment factor - */ - public final int getIncrement() { - return c; - } + - /** - * Set increment factor. - */ - public final void setIncrement( int c ) { - this.c = c; - setWide(); - } + /** @return int type diff --git a/java/org/apache/tomcat/util/bcel/generic/IMUL.java b/java/org/apache/tomcat/util/bcel/generic/IMUL.java deleted file mode 100644 index 3d0a801b2..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IMUL.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IMUL - Multiply ints - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class IMUL extends ArithmeticInstruction { - - /** Multiply ints - */ - public IMUL() { - super(org.apache.tomcat.util.bcel.Constants.IMUL); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/INEG.java b/java/org/apache/tomcat/util/bcel/generic/INEG.java deleted file mode 100644 index 8096c0b30..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/INEG.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * INEG - Negate int - *
Stack: ..., value -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class INEG extends ArithmeticInstruction { - - public INEG() { - super(org.apache.tomcat.util.bcel.Constants.INEG); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/INSTANCEOF.java b/java/org/apache/tomcat/util/bcel/generic/INSTANCEOF.java index edda28bdf..d09f06eb0 100644 --- a/java/org/apache/tomcat/util/bcel/generic/INSTANCEOF.java +++ b/java/org/apache/tomcat/util/bcel/generic/INSTANCEOF.java @@ -34,21 +34,11 @@ public class INSTANCEOF extends CPInstruction implements LoadClass, ExceptionThr } - public INSTANCEOF(int index) { - super(org.apache.tomcat.util.bcel.Constants.INSTANCEOF, index); - } + - public Class[] getExceptions() { - return org.apache.tomcat.util.bcel.ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION; - } + - public ObjectType getLoadClassType( ConstantPoolGen cpg ) { - Type t = getType(cpg); - if (t instanceof ArrayType) { - t = ((ArrayType) t).getBasicType(); - } - return (t instanceof ObjectType) ? (ObjectType) t : null; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/INVOKEINTERFACE.java b/java/org/apache/tomcat/util/bcel/generic/INVOKEINTERFACE.java index 669dbf005..703496bfe 100644 --- a/java/org/apache/tomcat/util/bcel/generic/INVOKEINTERFACE.java +++ b/java/org/apache/tomcat/util/bcel/generic/INVOKEINTERFACE.java @@ -18,8 +18,6 @@ package org.apache.tomcat.util.bcel.generic; import java.io.DataOutputStream; import java.io.IOException; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; import org.apache.tomcat.util.bcel.classfile.ConstantPool; import org.apache.tomcat.util.bcel.util.ByteSequence; @@ -43,14 +41,7 @@ public final class INVOKEINTERFACE extends InvokeInstruction { } - public INVOKEINTERFACE(int index, int nargs) { - super(Constants.INVOKEINTERFACE, index); - length = 5; - if (nargs < 1) { - throw new ClassGenException("Number of arguments must be > 0 " + nargs); - } - this.nargs = nargs; - } + /** @@ -65,13 +56,7 @@ public final class INVOKEINTERFACE extends InvokeInstruction { } - /** - * The count argument according to the Java Language Specification, - * Second Edition. - */ - public int getCount() { - return nargs; - } + /** @@ -98,14 +83,5 @@ public final class INVOKEINTERFACE extends InvokeInstruction { } - public Class[] getExceptions() { - Class[] cs = new Class[4 + ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 3] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ILLEGAL_ACCESS_ERROR; - cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 1] = ExceptionConstants.ABSTRACT_METHOD_ERROR; - cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/INVOKESPECIAL.java b/java/org/apache/tomcat/util/bcel/generic/INVOKESPECIAL.java index 764d371d8..9e17157d6 100644 --- a/java/org/apache/tomcat/util/bcel/generic/INVOKESPECIAL.java +++ b/java/org/apache/tomcat/util/bcel/generic/INVOKESPECIAL.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * INVOKESPECIAL - Invoke instance method; special handling for superclass, private * and instance initialization method invocations @@ -38,19 +35,8 @@ public class INVOKESPECIAL extends InvokeInstruction { } - public INVOKESPECIAL(int index) { - super(Constants.INVOKESPECIAL, index); - } + - public Class[] getExceptions() { - Class[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 3] = ExceptionConstants.UNSATISFIED_LINK_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ABSTRACT_METHOD_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/INVOKESTATIC.java b/java/org/apache/tomcat/util/bcel/generic/INVOKESTATIC.java index 78f252d7f..09d130dd3 100644 --- a/java/org/apache/tomcat/util/bcel/generic/INVOKESTATIC.java +++ b/java/org/apache/tomcat/util/bcel/generic/INVOKESTATIC.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * INVOKESTATIC - Invoke a class (static) method * @@ -37,17 +34,8 @@ public class INVOKESTATIC extends InvokeInstruction { } - public INVOKESTATIC(int index) { - super(Constants.INVOKESTATIC, index); - } + - public Class[] getExceptions() { - Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/INVOKEVIRTUAL.java b/java/org/apache/tomcat/util/bcel/generic/INVOKEVIRTUAL.java index 38eccfb7c..37e6fc1f2 100644 --- a/java/org/apache/tomcat/util/bcel/generic/INVOKEVIRTUAL.java +++ b/java/org/apache/tomcat/util/bcel/generic/INVOKEVIRTUAL.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * INVOKEVIRTUAL - Invoke instance method; dispatch based on class * @@ -37,19 +34,8 @@ public class INVOKEVIRTUAL extends InvokeInstruction { } - public INVOKEVIRTUAL(int index) { - super(Constants.INVOKEVIRTUAL, index); - } + - public Class[] getExceptions() { - Class[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 3] = ExceptionConstants.UNSATISFIED_LINK_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ABSTRACT_METHOD_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/IOR.java b/java/org/apache/tomcat/util/bcel/generic/IOR.java deleted file mode 100644 index fb16d474b..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IOR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IOR - Bitwise OR int - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class IOR extends ArithmeticInstruction { - - public IOR() { - super(org.apache.tomcat.util.bcel.Constants.IOR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IREM.java b/java/org/apache/tomcat/util/bcel/generic/IREM.java deleted file mode 100644 index cc3d00c6d..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IREM.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IREM - Remainder of int - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class IREM extends ArithmeticInstruction implements ExceptionThrower { - - /** Remainder of ints - */ - public IREM() { - super(org.apache.tomcat.util.bcel.Constants.IREM); - } - - - /** @return exceptions this instruction may cause - */ - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IRETURN.java b/java/org/apache/tomcat/util/bcel/generic/IRETURN.java deleted file mode 100644 index 75206585d..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IRETURN.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IRETURN - Return int from method - *
Stack: ..., value -> <empty>- * - * @version $Id$ - * @author M. Dahm - */ -public class IRETURN extends ReturnInstruction { - - /** Return int from method - */ - public IRETURN() { - super(org.apache.tomcat.util.bcel.Constants.IRETURN); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ISHL.java b/java/org/apache/tomcat/util/bcel/generic/ISHL.java deleted file mode 100644 index 66e519406..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ISHL.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ISHL - Arithmetic shift left int - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class ISHL extends ArithmeticInstruction { - - public ISHL() { - super(org.apache.tomcat.util.bcel.Constants.ISHL); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ISHR.java b/java/org/apache/tomcat/util/bcel/generic/ISHR.java deleted file mode 100644 index 26fa178ef..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ISHR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ISHR - Arithmetic shift right int - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class ISHR extends ArithmeticInstruction { - - public ISHR() { - super(org.apache.tomcat.util.bcel.Constants.ISHR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ISUB.java b/java/org/apache/tomcat/util/bcel/generic/ISUB.java deleted file mode 100644 index c36b61ef9..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/ISUB.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * ISUB - Substract ints - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class ISUB extends ArithmeticInstruction { - - /** Substract ints - */ - public ISUB() { - super(org.apache.tomcat.util.bcel.Constants.ISUB); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IUSHR.java b/java/org/apache/tomcat/util/bcel/generic/IUSHR.java deleted file mode 100644 index 28cf19e7c..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IUSHR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IUSHR - Logical shift right int - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class IUSHR extends ArithmeticInstruction { - - public IUSHR() { - super(org.apache.tomcat.util.bcel.Constants.IUSHR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/IXOR.java b/java/org/apache/tomcat/util/bcel/generic/IXOR.java deleted file mode 100644 index cc58262fe..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/IXOR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * IXOR - Bitwise XOR int - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class IXOR extends ArithmeticInstruction { - - public IXOR() { - super(org.apache.tomcat.util.bcel.Constants.IXOR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/Instruction.java b/java/org/apache/tomcat/util/bcel/generic/Instruction.java index ec4d52aea..a46d0bc4c 100644 --- a/java/org/apache/tomcat/util/bcel/generic/Instruction.java +++ b/java/org/apache/tomcat/util/bcel/generic/Instruction.java @@ -19,7 +19,6 @@ package org.apache.tomcat.util.bcel.generic; import java.io.DataOutputStream; import java.io.IOException; import java.io.Serializable; -import java.util.Locale; import org.apache.tomcat.util.bcel.Constants; import org.apache.tomcat.util.bcel.classfile.ConstantPool; import org.apache.tomcat.util.bcel.util.ByteSequence; @@ -101,28 +100,7 @@ public abstract class Instruction implements Cloneable, Serializable { } - /** - * Use with caution, since `BranchInstruction's have a `target' reference which - * is not copied correctly (only basic types are). This also applies for - * `Select' instructions with their multiple branch targets. - * - * @see BranchInstruction - * @return (shallow) copy of an instruction - */ - public Instruction copy() { - Instruction i = null; - // "Constant" instruction, no need to duplicate - if (InstructionConstants.INSTRUCTIONS[this.getOpcode()] != null) { - i = this; - } else { - try { - i = (Instruction) clone(); - } catch (CloneNotSupportedException e) { - System.err.println(e); - } - } - return i; - } + /** @@ -511,21 +489,10 @@ public abstract class Instruction implements Cloneable, Serializable { } - /** Get Comparator object used in the equals() method to determine - * equality of instructions. - * - * @return currently used comparator for equals() - */ - public static InstructionComparator getComparator() { - return cmp; - } + - /** Set comparator to be used for equals(). - */ - public static void setComparator( InstructionComparator c ) { - cmp = c; - } + /** Check for equality, delegated to comparator diff --git a/java/org/apache/tomcat/util/bcel/generic/InstructionConstants.java b/java/org/apache/tomcat/util/bcel/generic/InstructionConstants.java index 817015a48..ba5c7be41 100644 --- a/java/org/apache/tomcat/util/bcel/generic/InstructionConstants.java +++ b/java/org/apache/tomcat/util/bcel/generic/InstructionConstants.java @@ -16,8 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; - /** * This interface contains shareable instruction objects. * @@ -37,250 +35,131 @@ import org.apache.tomcat.util.bcel.Constants; */ public interface InstructionConstants { - /** Predefined instruction objects - */ - 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. */ 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 { + - Clinit() { - 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; - } - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/InstructionHandle.java b/java/org/apache/tomcat/util/bcel/generic/InstructionHandle.java index 9f6dbc713..29501ccd0 100644 --- a/java/org/apache/tomcat/util/bcel/generic/InstructionHandle.java +++ b/java/org/apache/tomcat/util/bcel/generic/InstructionHandle.java @@ -16,8 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -83,16 +81,7 @@ public class InstructionHandle implements java.io.Serializable { } - /** - * Temporarily swap the current instruction, without disturbing - * anything. Meant to be used by a debugger, implementing - * breakpoints. Current instruction is returned. - */ - public Instruction swapInstruction( Instruction i ) { - Instruction oldInstruction = instruction; - instruction = i; - return oldInstruction; - } + /*private*/protected InstructionHandle(Instruction i) { @@ -157,27 +146,10 @@ public class InstructionHandle implements java.io.Serializable { } - /** - * Delete contents, i.e., remove user access and make handle reusable. - */ - void dispose() { - next = prev = null; - instruction.dispose(); - instruction = null; - i_position = -1; - attributes = null; - removeAllTargeters(); - addHandle(); - } + - /** Remove all targeters, if any. - */ - public void removeAllTargeters() { - if (targeters != null) { - targeters.clear(); - } - } + /** @@ -202,22 +174,10 @@ public class InstructionHandle implements java.io.Serializable { } - public boolean hasTargeters() { - return (targeters != null) && (targeters.size() > 0); - } + - /** - * @return null, if there are no targeters - */ - public InstructionTargeter[] getTargeters() { - if (!hasTargeters()) { - return new InstructionTargeter[0]; - } - InstructionTargeter[] t = new InstructionTargeter[targeters.size()]; - targeters.toArray(t); - return t; - } + /** @return a (verbose) string representation of the contained instruction. @@ -234,48 +194,14 @@ public class InstructionHandle implements java.io.Serializable { } - /** Add an attribute to an instruction handle. - * - * @param key the key object to store/retrieve the attribute - * @param attr the attribute to associate with this handle - */ - public void addAttribute( Object key, Object attr ) { - if (attributes == null) { - attributes = new HashMap(3); - } - attributes.put(key, attr); - } + - /** Delete an attribute of an instruction handle. - * - * @param key the key object to retrieve the attribute - */ - public void removeAttribute( Object key ) { - if (attributes != null) { - attributes.remove(key); - } - } + - /** Get attribute of an instruction handle. - * - * @param key the key object to store/retrieve the attribute - */ - public Object getAttribute( Object key ) { - if (attributes != null) { - return attributes.get(key); - } - return null; - } + - /** @return all attributes associated with this handle - */ - public Collection getAttributes() { - if (attributes == null) { - attributes = new HashMap(3); - } - return attributes.values(); - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/InstructionList.java b/java/org/apache/tomcat/util/bcel/generic/InstructionList.java index dff58d052..58be38c5b 100644 --- a/java/org/apache/tomcat/util/bcel/generic/InstructionList.java +++ b/java/org/apache/tomcat/util/bcel/generic/InstructionList.java @@ -16,20 +16,9 @@ */ package org.apache.tomcat.util.bcel.generic; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; - import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.classfile.Constant; -import org.apache.tomcat.util.bcel.util.ByteSequence; /** * This class is a container for a list of 0) { - // Remember byte offset and associate it with the instruction - int off = bytes.getIndex(); - pos[count] = off; - /* Read one instruction from the byte stream, the byte position is set - * accordingly. - */ - Instruction i = Instruction.readInstruction(bytes); - InstructionHandle ih; - if (i instanceof BranchInstruction) { - ih = append((BranchInstruction) i); - } else { - ih = append(i); - } - ih.setPosition(off); - ihs[count] = ih; - count++; - } - } catch (IOException e) { - throw new ClassGenException(e.toString(), e); - } - byte_positions = new int[count]; // Trim to proper size - System.arraycopy(pos, 0, byte_positions, 0, count); - /* Pass 2: Look for BranchInstruction and update their targets, i.e., - * convert offsets to instruction handles. - */ - for (int i = 0; i < count; i++) { - if (ihs[i] instanceof BranchHandle) { - BranchInstruction bi = (BranchInstruction) ihs[i].instruction; - int target = bi.position + bi.getIndex(); /* Byte code position: - * relative -> absolute. */ - // Search for target position - InstructionHandle ih = findHandle(ihs, pos, count, target); - if (ih == null) { - throw new ClassGenException("Couldn't find target for branch: " + bi); - } - bi.setTarget(ih); // Update target - // If it is a Select instruction, update all branch targets - if (bi instanceof Select) { // Either LOOKUPSWITCH or TABLESWITCH - Select s = (Select) bi; - int[] indices = s.getIndices(); - for (int j = 0; j < indices.length; j++) { - target = bi.position + indices[j]; - ih = findHandle(ihs, pos, count, target); - if (ih == null) { - throw new ClassGenException("Couldn't find target for switch: " + bi); - } - s.setTarget(j, ih); // Update target - } - } - } - } - } + /** @@ -251,47 +136,10 @@ public class InstructionList implements Serializable { } - /** - * Append another list after instruction i contained in this list. - * Consumes argument list, i.e., it becomes empty. - * - * @param i where to append the instruction list - * @param il Instruction list to append to this one - * @return instruction handle pointing to the first appended instruction - */ - public InstructionHandle append( Instruction i, InstructionList il ) { - InstructionHandle ih; - if ((ih = findInstruction2(i)) == null) { - throw new ClassGenException("Instruction " + i + " is not contained in this list."); - } - return append(ih, il); - } + - /** - * Append another list to this one. - * Consumes argument list, i.e., it becomes empty. - * - * @param il list to append to end of this list - * @return instruction handle of the first appended instruction - */ - public InstructionHandle append( InstructionList il ) { - if (il == null) { - throw new ClassGenException("Appending null InstructionList"); - } - if (il.isEmpty()) { - return null; - } - if (isEmpty()) { - start = il.start; - end = il.end; - length = il.length; - il.clear(); - return start; - } else { - return append(end, il); // was end.instruction - } - } + /** @@ -339,455 +187,61 @@ public class InstructionList implements Serializable { } - /** - * Append a single instruction j after another instruction i, which - * must be in this list of course! - * - * @param i Instruction in list - * @param j Instruction to append after i in list - * @return instruction handle of the first appended instruction - */ - public InstructionHandle append( Instruction i, Instruction j ) { - return append(i, new InstructionList(j)); - } + - /** - * Append a compound instruction, after instruction i. - * - * @param i Instruction in list - * @param c The composite instruction (containing an InstructionList) - * @return instruction handle of the first appended instruction - */ - public InstructionHandle append( Instruction i, CompoundInstruction c ) { - return append(i, c.getInstructionList()); - } + - /** - * Append a compound instruction. - * - * @param c The composite instruction (containing an InstructionList) - * @return instruction handle of the first appended instruction - */ - public InstructionHandle append( CompoundInstruction c ) { - return append(c.getInstructionList()); - } + - /** - * Append a compound instruction. - * - * @param ih where to append the instruction list - * @param c The composite instruction (containing an InstructionList) - * @return instruction handle of the first appended instruction - */ - public InstructionHandle append( InstructionHandle ih, CompoundInstruction c ) { - return append(ih, c.getInstructionList()); - } + - /** - * Append an instruction after instruction (handle) ih contained in this list. - * - * @param ih where to append the instruction list - * @param i Instruction to append - * @return instruction handle pointing to the first appended instruction - */ - public InstructionHandle append( InstructionHandle ih, Instruction i ) { - return append(ih, new InstructionList(i)); - } + - /** - * Append an instruction after instruction (handle) ih contained in this list. - * - * @param ih where to append the instruction list - * @param i Instruction to append - * @return instruction handle pointing to the first appended instruction - */ - public BranchHandle append( InstructionHandle ih, BranchInstruction i ) { - BranchHandle bh = BranchHandle.getBranchHandle(i); - InstructionList il = new InstructionList(); - il.append(bh); - append(ih, il); - return bh; - } + - /** - * Insert another list before Instruction handle ih contained in this list. - * Consumes argument list, i.e., it becomes empty. - * - * @param ih where to append the instruction list - * @param il Instruction list to insert - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( InstructionHandle ih, InstructionList il ) { - if (il == null) { - throw new ClassGenException("Inserting null InstructionList"); - } - if (il.isEmpty()) { - return ih; - } - InstructionHandle prev = ih.prev, ret = il.start; - ih.prev = il.end; - il.end.next = ih; - il.start.prev = prev; - if (prev != null) { - prev.next = il.start; - } else { - start = il.start; // Update start ... - } - length += il.length; // Update length - il.clear(); - return ret; - } + - /** - * Insert another list. - * - * @param il list to insert before start of this list - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( InstructionList il ) { - if (isEmpty()) { - append(il); // Code is identical for this case - return start; - } else { - return insert(start, il); - } - } + - /** - * Insert an instruction at start of this list. - * - * @param ih instruction to insert - */ - private void insert( InstructionHandle ih ) { - if (isEmpty()) { - start = end = ih; - ih.next = ih.prev = null; - } else { - start.prev = ih; - ih.next = start; - ih.prev = null; - start = ih; - } - length++; - } + - /** - * Insert another list before Instruction i contained in this list. - * Consumes argument list, i.e., it becomes empty. - * - * @param i where to append the instruction list - * @param il Instruction list to insert - * @return instruction handle pointing to the first inserted instruction, - * i.e., il.getStart() - */ - public InstructionHandle insert( Instruction i, InstructionList il ) { - InstructionHandle ih; - if ((ih = findInstruction1(i)) == null) { - throw new ClassGenException("Instruction " + i + " is not contained in this list."); - } - return insert(ih, il); - } + - /** - * Insert an instruction at start of this list. - * - * @param i instruction to insert - * @return instruction handle of the inserted instruction - */ - public InstructionHandle insert( Instruction i ) { - InstructionHandle ih = InstructionHandle.getInstructionHandle(i); - insert(ih); - return ih; - } + - /** - * Insert a branch instruction at start of this list. - * - * @param i branch instruction to insert - * @return branch instruction handle of the appended instruction - */ - public BranchHandle insert( BranchInstruction i ) { - BranchHandle ih = BranchHandle.getBranchHandle(i); - insert(ih); - return ih; - } + - /** - * Insert a single instruction j before another instruction i, which - * must be in this list of course! - * - * @param i Instruction in list - * @param j Instruction to insert before i in list - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( Instruction i, Instruction j ) { - return insert(i, new InstructionList(j)); - } + - /** - * Insert a compound instruction before instruction i. - * - * @param i Instruction in list - * @param c The composite instruction (containing an InstructionList) - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( Instruction i, CompoundInstruction c ) { - return insert(i, c.getInstructionList()); - } + - /** - * Insert a compound instruction. - * - * @param c The composite instruction (containing an InstructionList) - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( CompoundInstruction c ) { - return insert(c.getInstructionList()); - } + - /** - * Insert an instruction before instruction (handle) ih contained in this list. - * - * @param ih where to insert to the instruction list - * @param i Instruction to insert - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( InstructionHandle ih, Instruction i ) { - return insert(ih, new InstructionList(i)); - } + - /** - * Insert a compound instruction. - * - * @param ih where to insert the instruction list - * @param c The composite instruction (containing an InstructionList) - * @return instruction handle of the first inserted instruction - */ - public InstructionHandle insert( InstructionHandle ih, CompoundInstruction c ) { - return insert(ih, c.getInstructionList()); - } + - /** - * Insert an instruction before instruction (handle) ih contained in this list. - * - * @param ih where to insert to the instruction list - * @param i Instruction to insert - * @return instruction handle of the first inserted instruction - */ - public BranchHandle insert( InstructionHandle ih, BranchInstruction i ) { - BranchHandle bh = BranchHandle.getBranchHandle(i); - InstructionList il = new InstructionList(); - il.append(bh); - insert(ih, il); - return bh; - } + - /** - * Take all instructions (handles) from "start" to "end" and append them after the - * new location "target". Of course, "end" must be after "start" and target must - * not be located withing this range. If you want to move something to the start of - * the list use null as value for target.
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class L2D extends ConversionInstruction { - - public L2D() { - super(org.apache.tomcat.util.bcel.Constants.L2D); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/L2F.java b/java/org/apache/tomcat/util/bcel/generic/L2F.java deleted file mode 100644 index 7952d6b52..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/L2F.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * L2F - Convert long to float - *
Stack: ..., value.word1, value.word2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class L2F extends ConversionInstruction { - - public L2F() { - super(org.apache.tomcat.util.bcel.Constants.L2F); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/L2I.java b/java/org/apache/tomcat/util/bcel/generic/L2I.java deleted file mode 100644 index 9d5e2c164..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/L2I.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * L2I - Convert long to int - *
Stack: ..., value.word1, value.word2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class L2I extends ConversionInstruction { - - public L2I() { - super(org.apache.tomcat.util.bcel.Constants.L2I); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LADD.java b/java/org/apache/tomcat/util/bcel/generic/LADD.java deleted file mode 100644 index c1650b4cd..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LADD.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LADD - Add longs - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class LADD extends ArithmeticInstruction { - - public LADD() { - super(org.apache.tomcat.util.bcel.Constants.LADD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LALOAD.java b/java/org/apache/tomcat/util/bcel/generic/LALOAD.java deleted file mode 100644 index 587a58f34..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LALOAD.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LALOAD - Load long from array - *
Stack: ..., arrayref, index -> ..., value1, value2- * - * @version $Id$ - * @author M. Dahm - */ -public class LALOAD extends ArrayInstruction implements StackProducer { - - /** Load long from array - */ - public LALOAD() { - super(org.apache.tomcat.util.bcel.Constants.LALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LAND.java b/java/org/apache/tomcat/util/bcel/generic/LAND.java deleted file mode 100644 index 4ca39322f..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LAND.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LAND - Bitwise AND longs - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class LAND extends ArithmeticInstruction { - - public LAND() { - super(org.apache.tomcat.util.bcel.Constants.LAND); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LASTORE.java b/java/org/apache/tomcat/util/bcel/generic/LASTORE.java deleted file mode 100644 index f7f9f2078..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LASTORE.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LASTORE - Store into long array - *
Stack: ..., arrayref, index, value.word1, value.word2 -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class LASTORE extends ArrayInstruction implements StackConsumer { - - /** Store long into array - */ - public LASTORE() { - super(org.apache.tomcat.util.bcel.Constants.LASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LCMP.java b/java/org/apache/tomcat/util/bcel/generic/LCMP.java deleted file mode 100644 index 50947ea35..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LCMP.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LCMP - Compare longs: - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result <= -1, 0, 1> - * - * @version $Id$ - * @author M. Dahm - */ -public class LCMP extends Instruction implements TypedInstruction, StackProducer, StackConsumer { - - public LCMP() { - super(org.apache.tomcat.util.bcel.Constants.LCMP, (short) 1); - } - - - /** @return Type.LONG - */ - public Type getType( ConstantPoolGen cp ) { - return Type.LONG; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LCONST.java b/java/org/apache/tomcat/util/bcel/generic/LCONST.java deleted file mode 100644 index 407da10b8..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LCONST.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LCONST - Push 0 or 1, other values cause an exception - * - *
Stack: ... -> ...,- * - * @version $Id$ - * @author M. Dahm - */ -public class LCONST extends Instruction implements ConstantPushInstruction, TypedInstruction { - - private long value; - - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - LCONST() { - } - - - public LCONST(long l) { - super(org.apache.tomcat.util.bcel.Constants.LCONST_0, (short) 1); - if (l == 0) { - opcode = org.apache.tomcat.util.bcel.Constants.LCONST_0; - } else if (l == 1) { - opcode = org.apache.tomcat.util.bcel.Constants.LCONST_1; - } else { - throw new ClassGenException("LCONST can be used only for 0 and 1: " + l); - } - value = l; - } - - - public Number getValue() { - return new Long(value); - } - - - /** @return Type.LONG - */ - public Type getType( ConstantPoolGen cp ) { - return Type.LONG; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LDC.java b/java/org/apache/tomcat/util/bcel/generic/LDC.java index 74c61cf6a..c50c91118 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LDC.java +++ b/java/org/apache/tomcat/util/bcel/generic/LDC.java @@ -39,10 +39,7 @@ public class LDC extends CPInstruction implements PushInstruction, ExceptionThro } - public LDC(int index) { - super(org.apache.tomcat.util.bcel.Constants.LDC_W, index); - setSize(); - } + // Adjust to proper size @@ -89,23 +86,7 @@ public class LDC extends CPInstruction implements PushInstruction, ExceptionThro } - public Object getValue( ConstantPoolGen cpg ) { - org.apache.tomcat.util.bcel.classfile.Constant c = cpg.getConstantPool().getConstant(index); - switch (c.getTag()) { - case org.apache.tomcat.util.bcel.Constants.CONSTANT_String: - int i = ((org.apache.tomcat.util.bcel.classfile.ConstantString) c).getStringIndex(); - c = cpg.getConstantPool().getConstant(i); - return ((org.apache.tomcat.util.bcel.classfile.ConstantUtf8) c).getBytes(); - case org.apache.tomcat.util.bcel.Constants.CONSTANT_Float: - return new Float(((org.apache.tomcat.util.bcel.classfile.ConstantFloat) c).getBytes()); - case org.apache.tomcat.util.bcel.Constants.CONSTANT_Integer: - return new Integer(((org.apache.tomcat.util.bcel.classfile.ConstantInteger) c).getBytes()); - case org.apache.tomcat.util.bcel.Constants.CONSTANT_Class: - return c; - default: // Never reached - throw new RuntimeException("Unknown or invalid constant type at " + index); - } - } + public Type getType( ConstantPoolGen cpg ) { @@ -124,7 +105,5 @@ public class LDC extends CPInstruction implements PushInstruction, ExceptionThro } - public Class[] getExceptions() { - return org.apache.tomcat.util.bcel.ExceptionConstants.EXCS_STRING_RESOLUTION; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/LDC2_W.java b/java/org/apache/tomcat/util/bcel/generic/LDC2_W.java index b55b02ff1..3872cd34c 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LDC2_W.java +++ b/java/org/apache/tomcat/util/bcel/generic/LDC2_W.java @@ -34,9 +34,7 @@ public class LDC2_W extends CPInstruction implements PushInstruction, TypedInstr } - public LDC2_W(int index) { - super(org.apache.tomcat.util.bcel.Constants.LDC2_W, index); - } + public Type getType( ConstantPoolGen cpg ) { @@ -51,15 +49,5 @@ public class LDC2_W extends CPInstruction implements PushInstruction, TypedInstr } - public Number getValue( ConstantPoolGen cpg ) { - org.apache.tomcat.util.bcel.classfile.Constant c = cpg.getConstantPool().getConstant(index); - switch (c.getTag()) { - case org.apache.tomcat.util.bcel.Constants.CONSTANT_Long: - return new Long(((org.apache.tomcat.util.bcel.classfile.ConstantLong) c).getBytes()); - case org.apache.tomcat.util.bcel.Constants.CONSTANT_Double: - return new Double(((org.apache.tomcat.util.bcel.classfile.ConstantDouble) c).getBytes()); - default: // Never reached - throw new RuntimeException("Unknown or invalid constant type at " + index); - } - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/LDC_W.java b/java/org/apache/tomcat/util/bcel/generic/LDC_W.java index 6defb6347..e48a2dbda 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LDC_W.java +++ b/java/org/apache/tomcat/util/bcel/generic/LDC_W.java @@ -37,9 +37,7 @@ public class LDC_W extends LDC { } - public LDC_W(int index) { - super(index); - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/LDIV.java b/java/org/apache/tomcat/util/bcel/generic/LDIV.java deleted file mode 100644 index da05f8980..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LDIV.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LDIV - Divide longs - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class LDIV extends ArithmeticInstruction implements ExceptionThrower { - - public LDIV() { - super(org.apache.tomcat.util.bcel.Constants.LDIV); - } - - - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LMUL.java b/java/org/apache/tomcat/util/bcel/generic/LMUL.java deleted file mode 100644 index f4e48a044..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LMUL.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LMUL - Multiply longs - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class LMUL extends ArithmeticInstruction { - - public LMUL() { - super(org.apache.tomcat.util.bcel.Constants.LMUL); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LNEG.java b/java/org/apache/tomcat/util/bcel/generic/LNEG.java deleted file mode 100644 index 29ddd5d29..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LNEG.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LNEG - Negate long - *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class LNEG extends ArithmeticInstruction { - - public LNEG() { - super(org.apache.tomcat.util.bcel.Constants.LNEG); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LOOKUPSWITCH.java b/java/org/apache/tomcat/util/bcel/generic/LOOKUPSWITCH.java index 673904a54..08ca015c6 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LOOKUPSWITCH.java +++ b/java/org/apache/tomcat/util/bcel/generic/LOOKUPSWITCH.java @@ -37,12 +37,7 @@ public class LOOKUPSWITCH extends Select { } - public LOOKUPSWITCH(int[] match, InstructionHandle[] targets, InstructionHandle defaultTarget) { - super(org.apache.tomcat.util.bcel.Constants.LOOKUPSWITCH, match, targets, defaultTarget); - length = (short) (9 + match_length * 8); /* alignment remainder assumed - * 0 here, until dump time. */ - fixed_length = length; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/LOR.java b/java/org/apache/tomcat/util/bcel/generic/LOR.java deleted file mode 100644 index c57d11c60..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LOR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LOR - Bitwise OR long - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class LOR extends ArithmeticInstruction { - - public LOR() { - super(org.apache.tomcat.util.bcel.Constants.LOR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LREM.java b/java/org/apache/tomcat/util/bcel/generic/LREM.java deleted file mode 100644 index 845a225db..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LREM.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LREM - Remainder of long - *
Stack: ..., value1, value2 -> result- * - * @version $Id$ - * @author M. Dahm - */ -public class LREM extends ArithmeticInstruction implements ExceptionThrower { - - public LREM() { - super(org.apache.tomcat.util.bcel.Constants.LREM); - } - - - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LRETURN.java b/java/org/apache/tomcat/util/bcel/generic/LRETURN.java deleted file mode 100644 index e63732245..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LRETURN.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LRETURN - Return long from method - *
Stack: ..., value.word1, value.word2 -> <empty>- * - * @version $Id$ - * @author M. Dahm - */ -public class LRETURN extends ReturnInstruction { - - public LRETURN() { - super(org.apache.tomcat.util.bcel.Constants.LRETURN); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LSHL.java b/java/org/apache/tomcat/util/bcel/generic/LSHL.java deleted file mode 100644 index 21794d78b..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LSHL.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LSHL - Arithmetic shift left long - *
Stack: ..., value1.word1, value1.word2, value2 -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class LSHL extends ArithmeticInstruction { - - public LSHL() { - super(org.apache.tomcat.util.bcel.Constants.LSHL); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LSHR.java b/java/org/apache/tomcat/util/bcel/generic/LSHR.java deleted file mode 100644 index 8f7d62b68..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LSHR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LSHR - Arithmetic shift right long - *
Stack: ..., value1.word1, value1.word2, value2 -> ..., result.word1, result.word2- * - * @version $Id$ - * @author M. Dahm - */ -public class LSHR extends ArithmeticInstruction { - - public LSHR() { - super(org.apache.tomcat.util.bcel.Constants.LSHR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LSUB.java b/java/org/apache/tomcat/util/bcel/generic/LSUB.java deleted file mode 100644 index d6c3d82ed..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LSUB.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LSUB - Substract longs - *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->- * ..., result.word1, result.word2 - * - * @version $Id$ - * @author M. Dahm - */ -public class LSUB extends ArithmeticInstruction { - - public LSUB() { - super(org.apache.tomcat.util.bcel.Constants.LSUB); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LUSHR.java b/java/org/apache/tomcat/util/bcel/generic/LUSHR.java deleted file mode 100644 index 1dd9a0369..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LUSHR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LUSHR - Logical shift right long - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class LUSHR extends ArithmeticInstruction { - - public LUSHR() { - super(org.apache.tomcat.util.bcel.Constants.LUSHR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LXOR.java b/java/org/apache/tomcat/util/bcel/generic/LXOR.java deleted file mode 100644 index 30e72fc63..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/LXOR.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * LXOR - Bitwise XOR long - *
Stack: ..., value1, value2 -> ..., result- * - * @version $Id$ - * @author M. Dahm - */ -public class LXOR extends ArithmeticInstruction { - - public LXOR() { - super(org.apache.tomcat.util.bcel.Constants.LXOR); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/LineNumberGen.java b/java/org/apache/tomcat/util/bcel/generic/LineNumberGen.java index da624e518..eafb2921a 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LineNumberGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/LineNumberGen.java @@ -44,25 +44,10 @@ public class LineNumberGen implements InstructionTargeter, Cloneable, java.io.Se } - /** - * @return true, if ih is target of this line number - */ - public boolean containsTarget( InstructionHandle ih ) { - return this.ih == ih; - } + - /** - * @param old_ih old target - * @param new_ih new target - */ - public void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih ) { - if (old_ih != ih) { - throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}"); - } else { - setInstruction(new_ih); - } - } + /** @@ -92,9 +77,7 @@ public class LineNumberGen implements InstructionTargeter, Cloneable, java.io.Se } - public InstructionHandle getInstruction() { - return ih; - } + public void setSourceLine( int src_line ) { @@ -102,7 +85,5 @@ public class LineNumberGen implements InstructionTargeter, Cloneable, java.io.Se } - public int getSourceLine() { - return src_line; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/LoadClass.java b/java/org/apache/tomcat/util/bcel/generic/LoadClass.java index ffbbfe74b..f40ba9143 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LoadClass.java +++ b/java/org/apache/tomcat/util/bcel/generic/LoadClass.java @@ -25,26 +25,8 @@ package org.apache.tomcat.util.bcel.generic; */ public interface LoadClass { - /** - * Returns the ObjectType of the referenced class or interface - * that may be loaded and resolved. - * @return object type that may be loaded or null if a primitive is - * referenced - */ - public ObjectType getLoadClassType( ConstantPoolGen cpg ); + - /** - * Returns the type associated with this instruction. - * LoadClass instances are always typed, but this type - * does not always refer to the type of the class or interface - * that it possibly forces to load. For example, GETFIELD would - * return the type of the field and not the type of the class - * where the field is defined. - * If no class is forced to be loaded, null is returned. - * An example for this is an ANEWARRAY instruction that creates - * an int[][]. - * @see #getLoadClassType(ConstantPoolGen) - */ - public Type getType( ConstantPoolGen cpg ); + } diff --git a/java/org/apache/tomcat/util/bcel/generic/LocalVariableGen.java b/java/org/apache/tomcat/util/bcel/generic/LocalVariableGen.java index 1d7b83167..1f478f742 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LocalVariableGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/LocalVariableGen.java @@ -16,7 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; import org.apache.tomcat.util.bcel.classfile.LocalVariable; /** @@ -39,27 +38,7 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo private InstructionHandle start, end; - /** - * Generate a local variable that with index `index'. Note that double and long - * variables need two indexs. Index indices have to be provided by the user. - * - * @param index index of local variable - * @param name its name - * @param type its type - * @param start from where the instruction is valid (null means from the start) - * @param end until where the instruction is valid (null means to the end) - */ - public LocalVariableGen(int index, String name, Type type, InstructionHandle start, - InstructionHandle end) { - if ((index < 0) || (index > Constants.MAX_SHORT)) { - throw new ClassGenException("Invalid index index: " + index); - } - this.name = name; - this.type = type; - this.index = index; - setStart(start); - setEnd(end); - } + /** @@ -89,9 +68,7 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo } - public void setIndex( int index ) { - this.index = index; - } + public int getIndex() { @@ -114,9 +91,7 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo } - public Type getType() { - return type; - } + public InstructionHandle getStart() { @@ -141,33 +116,10 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo } - /** - * @param old_ih old target, either start or end - * @param new_ih new target - */ - public void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih ) { - boolean targeted = false; - if (start == old_ih) { - targeted = true; - setStart(new_ih); - } - if (end == old_ih) { - targeted = true; - setEnd(new_ih); - } - if (!targeted) { - throw new ClassGenException("Not targeting " + old_ih + ", but {" + start + ", " + end - + "}"); - } - } + - /** - * @return true, if ih is target of this variable - */ - public boolean containsTarget( InstructionHandle ih ) { - return (start == ih) || (end == ih); - } + /** @return a hash code value for the object. diff --git a/java/org/apache/tomcat/util/bcel/generic/LocalVariableInstruction.java b/java/org/apache/tomcat/util/bcel/generic/LocalVariableInstruction.java index c93733712..0f14ec653 100644 --- a/java/org/apache/tomcat/util/bcel/generic/LocalVariableInstruction.java +++ b/java/org/apache/tomcat/util/bcel/generic/LocalVariableInstruction.java @@ -163,11 +163,7 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty } - /** @return canonical tag for instruction, e.g., ALOAD for ALOAD_0 - */ - public short getCanonicalTag() { - return canon_tag; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/MONITORENTER.java b/java/org/apache/tomcat/util/bcel/generic/MONITORENTER.java deleted file mode 100644 index 1f98a6058..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/MONITORENTER.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * MONITORENTER - Enter monitor for object - *
Stack: ..., objectref -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class MONITORENTER extends Instruction implements ExceptionThrower, StackConsumer { - - public MONITORENTER() { - super(org.apache.tomcat.util.bcel.Constants.MONITORENTER, (short) 1); - } - - - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/MONITOREXIT.java b/java/org/apache/tomcat/util/bcel/generic/MONITOREXIT.java deleted file mode 100644 index 5560a5cc3..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/MONITOREXIT.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * MONITOREXIT - Exit monitor for object - *
Stack: ..., objectref -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class MONITOREXIT extends Instruction implements ExceptionThrower, StackConsumer { - - public MONITOREXIT() { - super(org.apache.tomcat.util.bcel.Constants.MONITOREXIT, (short) 1); - } - - - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION - }; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/MULTIANEWARRAY.java b/java/org/apache/tomcat/util/bcel/generic/MULTIANEWARRAY.java index 6e68cba1e..64ba8a611 100644 --- a/java/org/apache/tomcat/util/bcel/generic/MULTIANEWARRAY.java +++ b/java/org/apache/tomcat/util/bcel/generic/MULTIANEWARRAY.java @@ -18,7 +18,6 @@ package org.apache.tomcat.util.bcel.generic; import java.io.DataOutputStream; import java.io.IOException; -import org.apache.tomcat.util.bcel.ExceptionConstants; import org.apache.tomcat.util.bcel.classfile.ConstantPool; import org.apache.tomcat.util.bcel.util.ByteSequence; @@ -43,14 +42,7 @@ public class MULTIANEWARRAY extends CPInstruction implements LoadClass, Allocati } - public MULTIANEWARRAY(int index, short dimensions) { - super(org.apache.tomcat.util.bcel.Constants.MULTIANEWARRAY, index); - if (dimensions < 1) { - throw new ClassGenException("Invalid dimensions value: " + dimensions); - } - this.dimensions = dimensions; - length = 4; - } + /** @@ -74,12 +66,7 @@ public class MULTIANEWARRAY extends CPInstruction implements LoadClass, Allocati } - /** - * @return number of dimensions to be created - */ - public final short getDimensions() { - return dimensions; - } + /** @@ -108,21 +95,8 @@ public class MULTIANEWARRAY extends CPInstruction implements LoadClass, Allocati } - public Class[] getExceptions() { - Class[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); - cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length + 1] = ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION; - cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.ILLEGAL_ACCESS_ERROR; - return cs; - } + - public ObjectType getLoadClassType( ConstantPoolGen cpg ) { - Type t = getType(cpg); - if (t instanceof ArrayType) { - t = ((ArrayType) t).getBasicType(); - } - return (t instanceof ObjectType) ? (ObjectType) t : null; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/MethodGen.java b/java/org/apache/tomcat/util/bcel/generic/MethodGen.java index 17846d984..1cd16d095 100644 --- a/java/org/apache/tomcat/util/bcel/generic/MethodGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/MethodGen.java @@ -17,26 +17,14 @@ package org.apache.tomcat.util.bcel.generic; import java.util.ArrayList; -import java.util.Hashtable; import java.util.Iterator; import java.util.List; -import java.util.Stack; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.classfile.AnnotationEntry; -import org.apache.tomcat.util.bcel.classfile.Annotations; import org.apache.tomcat.util.bcel.classfile.Attribute; import org.apache.tomcat.util.bcel.classfile.Code; -import org.apache.tomcat.util.bcel.classfile.CodeException; import org.apache.tomcat.util.bcel.classfile.ExceptionTable; -import org.apache.tomcat.util.bcel.classfile.LineNumber; -import org.apache.tomcat.util.bcel.classfile.LineNumberTable; import org.apache.tomcat.util.bcel.classfile.LocalVariable; import org.apache.tomcat.util.bcel.classfile.LocalVariableTable; -import org.apache.tomcat.util.bcel.classfile.LocalVariableTypeTable; import org.apache.tomcat.util.bcel.classfile.Method; -import org.apache.tomcat.util.bcel.classfile.ParameterAnnotationEntry; -import org.apache.tomcat.util.bcel.classfile.ParameterAnnotations; -import org.apache.tomcat.util.bcel.classfile.RuntimeVisibleParameterAnnotations; import org.apache.tomcat.util.bcel.classfile.Utility; import org.apache.tomcat.util.bcel.util.BCELComparator; @@ -92,260 +80,22 @@ public class MethodGen extends FieldGenOrMethodGen { }; - /** - * Declare method. If the method is non-static the constructor - * automatically declares a local variable `$this' in slot 0. The - * actual code is contained in the `il' parameter, which may further - * manipulated by the user. But he must take care not to remove any - * instruction (handles) that are still referenced from this object. - * - * For example one may not add a local variable and later remove the - * instructions it refers to without causing havoc. It is safe - * however if you remove that local variable, too. - * - * @param access_flags access qualifiers - * @param return_type method type - * @param arg_types argument types - * @param arg_names argument names (if this is null, default names will be provided - * for them) - * @param method_name name of method - * @param class_name class name containing this method (may be null, if you don't care) - * @param il instruction list associated with this method, may be null only for - * abstract or native methods - * @param cp constant pool - */ - public MethodGen(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, - String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { - setAccessFlags(access_flags); - setType(return_type); - setArgumentTypes(arg_types); - setArgumentNames(arg_names); - setName(method_name); - setClassName(class_name); - setInstructionList(il); - setConstantPool(cp); - boolean abstract_ = isAbstract() || isNative(); - InstructionHandle start = null; - InstructionHandle end = null; - if (!abstract_) { - start = il.getStart(); - end = il.getEnd(); - /* Add local variables, namely the implicit `this' and the arguments - */ - if (!isStatic() && (class_name != null)) { // Instance method -> `this' is local var 0 - addLocalVariable("this", new ObjectType(class_name), start, end); - } - } - if (arg_types != null) { - int size = arg_types.length; - for (int i = 0; i < size; i++) { - if (Type.VOID == arg_types[i]) { - throw new ClassGenException("'void' is an illegal argument type for a method"); - } - } - if (arg_names != null) { // Names for variables provided? - if (size != arg_names.length) { - throw new ClassGenException("Mismatch in argument array lengths: " + size - + " vs. " + arg_names.length); - } - } else { // Give them dummy names - arg_names = new String[size]; - for (int i = 0; i < size; i++) { - arg_names[i] = "arg" + i; - } - setArgumentNames(arg_names); - } - if (!abstract_) { - for (int i = 0; i < size; i++) { - addLocalVariable(arg_names[i], arg_types[i], start, end); - } - } - } - } + - /** - * Instantiate from existing method. - * - * @param m method - * @param class_name class name containing this method - * @param cp constant pool - */ - public MethodGen(Method m, String class_name, ConstantPoolGen cp) { - this(m.getAccessFlags(), Type.getReturnType(m.getSignature()), Type.getArgumentTypes(m - .getSignature()), null /* may be overridden anyway */ - , m.getName(), class_name, - ((m.getAccessFlags() & (Constants.ACC_ABSTRACT | Constants.ACC_NATIVE)) == 0) - ? new InstructionList(m.getCode().getCode()) - : null, cp); - Attribute[] attributes = m.getAttributes(); - for (int i = 0; i < attributes.length; i++) { - Attribute a = attributes[i]; - if (a instanceof Code) { - Code c = (Code) a; - setMaxStack(c.getMaxStack()); - setMaxLocals(c.getMaxLocals()); - CodeException[] ces = c.getExceptionTable(); - if (ces != null) { - for (int j = 0; j < ces.length; j++) { - CodeException ce = ces[j]; - int type = ce.getCatchType(); - ObjectType c_type = null; - if (type > 0) { - String cen = m.getConstantPool().getConstantString(type, - Constants.CONSTANT_Class); - c_type = new ObjectType(cen); - } - int end_pc = ce.getEndPC(); - int length = m.getCode().getCode().length; - InstructionHandle end; - if (length == end_pc) { // May happen, because end_pc is exclusive - end = il.getEnd(); - } else { - end = il.findHandle(end_pc); - end = end.getPrev(); // Make it inclusive - } - addExceptionHandler(il.findHandle(ce.getStartPC()), end, il.findHandle(ce - .getHandlerPC()), c_type); - } - } - Attribute[] c_attributes = c.getAttributes(); - for (int j = 0; j < c_attributes.length; j++) { - a = c_attributes[j]; - if (a instanceof LineNumberTable) { - LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable(); - for (int k = 0; k < ln.length; k++) { - LineNumber l = ln[k]; - InstructionHandle ih = il.findHandle(l.getStartPC()); - if (ih != null) { - addLineNumber(ih, l.getLineNumber()); - } - } - } else if (a instanceof LocalVariableTable) { - LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable(); - removeLocalVariables(); - for (int k = 0; k < lv.length; k++) { - LocalVariable l = lv[k]; - InstructionHandle start = il.findHandle(l.getStartPC()); - InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength()); - // Repair malformed handles - if (null == start) { - start = il.getStart(); - } - if (null == end) { - end = il.getEnd(); - } - addLocalVariable(l.getName(), Type.getType(l.getSignature()), l - .getIndex(), start, end); - } - } else if (a instanceof LocalVariableTypeTable) { - LocalVariable[] lv = ((LocalVariableTypeTable) a).getLocalVariableTypeTable(); - removeLocalVariables(); - for (int k = 0; k < lv.length; k++) { - LocalVariable l = lv[k]; - InstructionHandle start = il.findHandle(l.getStartPC()); - InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength()); - // Repair malformed handles - if (null == start) { - start = il.getStart(); - } - if (null == end) { - end = il.getEnd(); - } - addLocalVariable(l.getName(), Type.getType(l.getSignature()), l - .getIndex(), start, end); - } - } else { - addCodeAttribute(a); - } - } - } else if (a instanceof ExceptionTable) { - String[] names = ((ExceptionTable) a).getExceptionNames(); - for (int j = 0; j < names.length; j++) { - addException(names[j]); - } - } else if (a instanceof Annotations) { - Annotations runtimeAnnotations = (Annotations) a; - AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries(); - for (int k = 0; k < aes.length; k++) { - AnnotationEntry element = aes[k]; - addAnnotationEntry(new AnnotationEntryGen(element, cp, false)); - } - } else { - addAttribute(a); - } - } - } + - /** - * Adds a local variable to this method. - * - * @param name variable name - * @param type variable type - * @param slot the index of the local variable, if type is long or double, the next available - * index is slot+2 - * @param start from where the variable is valid - * @param end until where the variable is valid - * @return new local variable object - * @see LocalVariable - */ - public LocalVariableGen addLocalVariable( String name, Type type, int slot, - InstructionHandle start, InstructionHandle end ) { - byte t = type.getType(); - if (t != Constants.T_ADDRESS) { - int add = type.getSize(); - if (slot + add > max_locals) { - max_locals = slot + add; - } - LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end); - int i; - if ((i = variable_vec.indexOf(l)) >= 0) { - variable_vec.set(i, l); - } else { - variable_vec.add(l); - } - return l; - } else { - throw new IllegalArgumentException("Can not use " + type - + " as type for local variable"); - } - } + - /** - * Adds a local variable to this method and assigns an index automatically. - * - * @param name variable name - * @param type variable type - * @param start from where the variable is valid, if this is null, - * it is valid from the start - * @param end until where the variable is valid, if this is null, - * it is valid to the end - * @return new local variable object - * @see LocalVariable - */ - public LocalVariableGen addLocalVariable( String name, Type type, InstructionHandle start, - InstructionHandle end ) { - return addLocalVariable(name, type, max_locals, start, end); - } + - /** - * Remove a local variable, its slot will not be reused, if you do not use addLocalVariable - * with an explicit index argument. - */ - public void removeLocalVariable( LocalVariableGen l ) { - variable_vec.remove(l); - } + - /** - * Remove all local variables. - */ - public void removeLocalVariables() { - variable_vec.clear(); - } + /** @@ -419,440 +169,119 @@ public class MethodGen extends FieldGenOrMethodGen { } - /** - * Give an instruction a line number corresponding to the source code line. - * - * @param ih instruction to tag - * @return new line number object - * @see LineNumber - */ - public LineNumberGen addLineNumber( InstructionHandle ih, int src_line ) { - LineNumberGen l = new LineNumberGen(ih, src_line); - line_number_vec.add(l); - return l; - } - - - /** - * Remove a line number. - */ - public void removeLineNumber( LineNumberGen l ) { - line_number_vec.remove(l); - } - - - /** - * Remove all line numbers. - */ - public void removeLineNumbers() { - line_number_vec.clear(); - } + - /* - * @return array of line numbers - */ - public LineNumberGen[] getLineNumbers() { - LineNumberGen[] lg = new LineNumberGen[line_number_vec.size()]; - line_number_vec.toArray(lg); - return lg; - } + - /** - * @return `LineNumberTable' attribute of all the local variables of this method. - */ - public LineNumberTable getLineNumberTable( ConstantPoolGen cp ) { - int size = line_number_vec.size(); - LineNumber[] ln = new LineNumber[size]; - try { - for (int i = 0; i < size; i++) { - ln[i] = ((LineNumberGen) line_number_vec.get(i)).getLineNumber(); - } - } catch (ArrayIndexOutOfBoundsException e) { - } // Never occurs - return new LineNumberTable(cp.addUtf8("LineNumberTable"), 2 + ln.length * 4, ln, cp - .getConstantPool()); - } + - /** - * Add an exception handler, i.e., specify region where a handler is active and an - * instruction where the actual handling is done. - * - * @param start_pc Start of region (inclusive) - * @param end_pc End of region (inclusive) - * @param handler_pc Where handling is done - * @param catch_type class type of handled exception or null if any - * exception is handled - * @return new exception handler object - */ - public CodeExceptionGen addExceptionHandler( InstructionHandle start_pc, - InstructionHandle end_pc, InstructionHandle handler_pc, ObjectType catch_type ) { - if ((start_pc == null) || (end_pc == null) || (handler_pc == null)) { - throw new ClassGenException("Exception handler target is null instruction"); - } - CodeExceptionGen c = new CodeExceptionGen(start_pc, end_pc, handler_pc, catch_type); - exception_vec.add(c); - return c; - } + - /** - * Remove an exception handler. - */ - public void removeExceptionHandler( CodeExceptionGen c ) { - exception_vec.remove(c); - } + - /** - * Remove all line numbers. - */ - public void removeExceptionHandlers() { - exception_vec.clear(); - } + - /* - * @return array of declared exception handlers - */ - public CodeExceptionGen[] getExceptionHandlers() { - CodeExceptionGen[] cg = new CodeExceptionGen[exception_vec.size()]; - exception_vec.toArray(cg); - return cg; - } + - /** - * @return code exceptions for `Code' attribute - */ - private CodeException[] getCodeExceptions() { - int size = exception_vec.size(); - CodeException[] c_exc = new CodeException[size]; - try { - for (int i = 0; i < size; i++) { - CodeExceptionGen c = (CodeExceptionGen) exception_vec.get(i); - c_exc[i] = c.getCodeException(cp); - } - } catch (ArrayIndexOutOfBoundsException e) { - } - return c_exc; - } + - /** - * Add an exception possibly thrown by this method. - * - * @param class_name (fully qualified) name of exception - */ - public void addException( String class_name ) { - throws_vec.add(class_name); - } + - /** - * Remove an exception. - */ - public void removeException( String c ) { - throws_vec.remove(c); - } + - /** - * Remove all exceptions. - */ - public void removeExceptions() { - throws_vec.clear(); - } + - /* - * @return array of thrown exceptions - */ - public String[] getExceptions() { - String[] e = new String[throws_vec.size()]; - throws_vec.toArray(e); - return e; - } + - /** - * @return `Exceptions' attribute of all the exceptions thrown by this method. - */ - private ExceptionTable getExceptionTable( ConstantPoolGen cp ) { - int size = throws_vec.size(); - int[] ex = new int[size]; - try { - for (int i = 0; i < size; i++) { - ex[i] = cp.addClass((String) throws_vec.get(i)); - } - } catch (ArrayIndexOutOfBoundsException e) { - } - return new ExceptionTable(cp.addUtf8("Exceptions"), 2 + 2 * size, ex, cp.getConstantPool()); - } + - /** - * Add an attribute to the code. Currently, the JVM knows about the - * LineNumberTable, LocalVariableTable and StackMap attributes, - * where the former two will be generated automatically and the - * latter is used for the MIDP only. Other attributes will be - * ignored by the JVM but do no harm. - * - * @param a attribute to be added - */ - public void addCodeAttribute( Attribute a ) { - code_attrs_vec.add(a); - } + - /** - * Remove a code attribute. - */ - public void removeCodeAttribute( Attribute a ) { - code_attrs_vec.remove(a); - } + - /** - * Remove all code attributes. - */ - public void removeCodeAttributes() { - code_attrs_vec.clear(); - } + - /** - * @return all attributes of this method. - */ - public Attribute[] getCodeAttributes() { - Attribute[] attributes = new Attribute[code_attrs_vec.size()]; - code_attrs_vec.toArray(attributes); - return attributes; - } - public void addAnnotationsAsAttribute(ConstantPoolGen cp) { - Attribute[] attrs = Utility.getAnnotationAttributes(cp,annotation_vec); - for (int i = 0; i < attrs.length; i++) { - addAttribute(attrs[i]); - } - } + + + - public void addParameterAnnotationsAsAttribute(ConstantPoolGen cp) { - if (!hasParameterAnnotations) return; - Attribute[] attrs = Utility.getParameterAnnotationAttributes(cp,param_annotations); - if (attrs!=null) { - for (int i = 0; i < attrs.length; i++) { - addAttribute(attrs[i]); - } - } - } - /** - * Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, - * before calling this method (the same applies for max locals). - * - * @return method object - */ - public Method getMethod() { - String signature = getSignature(); - int name_index = cp.addUtf8(name); - int signature_index = cp.addUtf8(signature); - /* Also updates positions of instructions, i.e., their indices - */ - byte[] byte_code = null; - if (il != null) { - byte_code = il.getByteCode(); - } - LineNumberTable lnt = null; - LocalVariableTable lvt = null; - /* Create LocalVariableTable and LineNumberTable attributes (for debuggers, e.g.) - */ - if ((variable_vec.size() > 0) && !strip_attributes) { - addCodeAttribute(lvt = getLocalVariableTable(cp)); - } - if ((line_number_vec.size() > 0) && !strip_attributes) { - addCodeAttribute(lnt = getLineNumberTable(cp)); - } - Attribute[] code_attrs = getCodeAttributes(); - /* Each attribute causes 6 additional header bytes - */ - int attrs_len = 0; - for (int i = 0; i < code_attrs.length; i++) { - attrs_len += (code_attrs[i].getLength() + 6); - } - CodeException[] c_exc = getCodeExceptions(); - int exc_len = c_exc.length * 8; // Every entry takes 8 bytes - Code code = null; - if ((il != null) && !isAbstract() && !isNative()) { - // Remove any stale code attribute - Attribute[] attributes = getAttributes(); - for (int i = 0; i < attributes.length; i++) { - Attribute a = attributes[i]; - if (a instanceof Code) { - removeAttribute(a); - } - } - code = new Code(cp.addUtf8("Code"), 8 + byte_code.length + // prologue byte code - 2 + exc_len + // exceptions - 2 + attrs_len, // attributes - max_stack, max_locals, byte_code, c_exc, code_attrs, cp.getConstantPool()); - addAttribute(code); - } - addAnnotationsAsAttribute(cp); - addParameterAnnotationsAsAttribute(cp); - ExceptionTable et = null; - if (throws_vec.size() > 0) { - addAttribute(et = getExceptionTable(cp)); - // Add `Exceptions' if there are "throws" clauses - } - Method m = new Method(access_flags, name_index, signature_index, getAttributes(), cp - .getConstantPool()); - // Undo effects of adding attributes - if (lvt != null) { - removeCodeAttribute(lvt); - } - if (lnt != null) { - removeCodeAttribute(lnt); - } - if (code != null) { - removeAttribute(code); - } - if (et != null) { - removeAttribute(et); - } - return m; - } + - /** - * Remove all NOPs from the instruction list (if possible) and update every - * object refering to them, i.e., branch instructions, local variables and - * exception handlers. - */ - public void removeNOPs() { - if (il != null) { - InstructionHandle next; - /* Check branch instructions. - */ - for (InstructionHandle ih = il.getStart(); ih != null; ih = next) { - next = ih.next; - if ((next != null) && (ih.getInstruction() instanceof NOP)) { - try { - il.delete(ih); - } catch (TargetLostException e) { - InstructionHandle[] targets = e.getTargets(); - for (int i = 0; i < targets.length; i++) { - InstructionTargeter[] targeters = targets[i].getTargeters(); - for (int j = 0; j < targeters.length; j++) { - targeters[j].updateTarget(targets[i], next); - } - } - } - } - } - } - } + - /** - * Set maximum number of local variables. - */ - public void setMaxLocals( int m ) { - max_locals = m; - } + - public int getMaxLocals() { - return max_locals; - } + - /** - * Set maximum stack size for this method. - */ - public void setMaxStack( int m ) { - max_stack = m; - } + - public int getMaxStack() { - return max_stack; - } + - /** @return class that contains this method - */ - public String getClassName() { - return class_name; - } + - public void setClassName( String class_name ) { - this.class_name = class_name; - } + - public void setReturnType( Type return_type ) { - setType(return_type); - } + - public Type getReturnType() { - return getType(); - } + - public void setArgumentTypes( Type[] arg_types ) { - this.arg_types = arg_types; - } + - public Type[] getArgumentTypes() { - return (Type[]) arg_types.clone(); - } + - public void setArgumentType( int i, Type type ) { - arg_types[i] = type; - } + - public Type getArgumentType( int i ) { - return arg_types[i]; - } + - public void setArgumentNames( String[] arg_names ) { - this.arg_names = arg_names; - } + - public String[] getArgumentNames() { - return (String[]) arg_names.clone(); - } + - public void setArgumentName( int i, String name ) { - arg_names[i] = name; - } + - public String getArgumentName( int i ) { - return arg_names[i]; - } + - public InstructionList getInstructionList() { - return il; - } + - public void setInstructionList( InstructionList il ) { - this.il = il; - } + public String getSignature() { @@ -860,210 +289,31 @@ public class MethodGen extends FieldGenOrMethodGen { } - /** - * Computes max. stack size by performing control flow analysis. - */ - public void setMaxStack() { - if (il != null) { - max_stack = getMaxStack(cp, il, getExceptionHandlers()); - } else { - max_stack = 0; - } - } - - - /** - * Compute maximum number of local variables. - */ - public void setMaxLocals() { - if (il != null) { - int max = isStatic() ? 0 : 1; - if (arg_types != null) { - for (int i = 0; i < arg_types.length; i++) { - max += arg_types[i].getSize(); - } - } - for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) { - Instruction ins = ih.getInstruction(); - if ((ins instanceof LocalVariableInstruction) || (ins instanceof RET) - || (ins instanceof IINC)) { - int index = ((IndexedInstruction) ins).getIndex() - + ((TypedInstruction) ins).getType(cp).getSize(); - if (index > max) { - max = index; - } - } - } - max_locals = max; - } else { - max_locals = 0; - } - } - - - /** Do not/Do produce attributes code attributesLineNumberTable and - * LocalVariableTable, like javac -O - */ - public void stripAttributes( boolean flag ) { - strip_attributes = flag; - } - - static final class BranchTarget { - - InstructionHandle target; - int stackDepth; - - - BranchTarget(InstructionHandle target, int stackDepth) { - this.target = target; - this.stackDepth = stackDepth; - } - } - - static final class BranchStack { - - Stack branchTargets = new Stack(); - Hashtable visitedTargets = new Hashtable(); - - - public void push( InstructionHandle target, int stackDepth ) { - if (visited(target)) { - return; - } - branchTargets.push(visit(target, stackDepth)); - } + - public BranchTarget pop() { - if (!branchTargets.empty()) { - BranchTarget bt = (BranchTarget) branchTargets.pop(); - return bt; - } - return null; - } + - private final BranchTarget visit( InstructionHandle target, int stackDepth ) { - BranchTarget bt = new BranchTarget(target, stackDepth); - visitedTargets.put(target, bt); - return bt; - } + + - private final boolean visited( InstructionHandle target ) { - return (visitedTargets.get(target) != null); - } - } + - /** - * Computes stack usage of an instruction list by performing control flow analysis. - * - * @return maximum stack depth used by method - */ - public static int getMaxStack( ConstantPoolGen cp, InstructionList il, CodeExceptionGen[] et ) { - BranchStack branchTargets = new BranchStack(); - /* Initially, populate the branch stack with the exception - * handlers, because these aren't (necessarily) branched to - * explicitly. in each case, the stack will have depth 1, - * containing the exception object. - */ - for (int i = 0; i < et.length; i++) { - InstructionHandle handler_pc = et[i].getHandlerPC(); - if (handler_pc != null) { - branchTargets.push(handler_pc, 1); - } - } - int stackDepth = 0, maxStackDepth = 0; - InstructionHandle ih = il.getStart(); - while (ih != null) { - Instruction instruction = ih.getInstruction(); - short opcode = instruction.getOpcode(); - int delta = instruction.produceStack(cp) - instruction.consumeStack(cp); - stackDepth += delta; - if (stackDepth > maxStackDepth) { - maxStackDepth = stackDepth; - } - // choose the next instruction based on whether current is a branch. - if (instruction instanceof BranchInstruction) { - BranchInstruction branch = (BranchInstruction) instruction; - if (instruction instanceof Select) { - // explore all of the select's targets. the default target is handled below. - Select select = (Select) branch; - InstructionHandle[] targets = select.getTargets(); - for (int i = 0; i < targets.length; i++) { - branchTargets.push(targets[i], stackDepth); - } - // nothing to fall through to. - ih = null; - } else if (!(branch instanceof IfInstruction)) { - // if an instruction that comes back to following PC, - // push next instruction, with stack depth reduced by 1. - if (opcode == Constants.JSR || opcode == Constants.JSR_W) { - branchTargets.push(ih.getNext(), stackDepth - 1); - } - ih = null; - } - // for all branches, the target of the branch is pushed on the branch stack. - // conditional branches have a fall through case, selects don't, and - // jsr/jsr_w return to the next instruction. - branchTargets.push(branch.getTarget(), stackDepth); - } else { - // check for instructions that terminate the method. - if (opcode == Constants.ATHROW || opcode == Constants.RET - || (opcode >= Constants.IRETURN && opcode <= Constants.RETURN)) { - ih = null; - } - } - // normal case, go to the next instruction. - if (ih != null) { - ih = ih.getNext(); - } - // if we have no more instructions, see if there are any deferred branches to explore. - if (ih == null) { - BranchTarget bt = branchTargets.pop(); - if (bt != null) { - ih = bt.target; - stackDepth = bt.stackDepth; - } - } - } - return maxStackDepth; - } + private List observers; - /** Add observer for this object. - */ - public void addObserver( MethodObserver o ) { - if (observers == null) { - observers = new ArrayList(); - } - observers.add(o); - } + - /** Remove observer for this object. - */ - public void removeObserver( MethodObserver o ) { - if (observers != null) { - observers.remove(o); - } - } + - /** Call notify() method on all observers. This method is not called - * automatically whenever the state has changed, but has to be - * called by the user after he has finished editing the object. - */ - public void update() { - if (observers != null) { - for (Iterator e = observers.iterator(); e.hasNext();) { - ((MethodObserver) e.next()).notify(this); - } - } - } + /** @@ -1094,134 +344,10 @@ public class MethodGen extends FieldGenOrMethodGen { } - /** @return deep copy of this method - */ - public MethodGen copy( String class_name, ConstantPoolGen cp ) { - Method m = ((MethodGen) clone()).getMethod(); - MethodGen mg = new MethodGen(m, class_name, this.cp); - if (this.cp != cp) { - mg.setConstantPool(cp); - mg.getInstructionList().replaceConstantPool(this.cp, cp); - } - return mg; - } - //J5TODO: Should param_annotations be an array of arrays? Rather than an array of lists, this - // is more likely to suggest to the caller it is readonly (which a List does not). - /** - * Return a list of AnnotationGen objects representing parameter annotations - */ - public List getAnnotationsOnParameter(int i) { - ensureExistingParameterAnnotationsUnpacked(); - if (!hasParameterAnnotations || i>arg_types.length) return null; - return param_annotations[i]; - } - /** - * Goes through the attributes on the method and identifies any that are - * RuntimeParameterAnnotations, extracting their contents and storing them - * as parameter annotations. There are two kinds of parameter annotation - - * visible and invisible. Once they have been unpacked, these attributes are - * deleted. (The annotations will be rebuilt as attributes when someone - * builds a Method object out of this MethodGen object). - */ - private void ensureExistingParameterAnnotationsUnpacked() - { - if (haveUnpackedParameterAnnotations) - return; - // Find attributes that contain parameter annotation data - Attribute[] attrs = getAttributes(); - ParameterAnnotations paramAnnVisAttr = null; - ParameterAnnotations paramAnnInvisAttr = null; - for (int i = 0; i < attrs.length; i++) - { - Attribute attribute = attrs[i]; - if (attribute instanceof ParameterAnnotations) - { - // Initialize param_annotations - if (!hasParameterAnnotations) - { - param_annotations = new List[arg_types.length]; - for (int j = 0; j < arg_types.length; j++) - param_annotations[j] = new ArrayList(); - } - hasParameterAnnotations = true; - ParameterAnnotations rpa = (ParameterAnnotations) attribute; - if (rpa instanceof RuntimeVisibleParameterAnnotations) - paramAnnVisAttr = rpa; - else - paramAnnInvisAttr = rpa; - for (int j = 0; j < arg_types.length; j++) - { - // This returns Annotation[] ... - ParameterAnnotationEntry immutableArray = rpa - .getParameterAnnotationEntries()[j]; - // ... which needs transforming into an AnnotationGen[] ... - List mutable = makeMutableVersion(immutableArray.getAnnotationEntries()); - // ... then add these to any we already know about - param_annotations[j].addAll(mutable); - } - } - } - if (paramAnnVisAttr != null) - removeAttribute(paramAnnVisAttr); - if (paramAnnInvisAttr != null) - removeAttribute(paramAnnInvisAttr); - haveUnpackedParameterAnnotations = true; - } - - private List /* AnnotationGen */makeMutableVersion(AnnotationEntry[] mutableArray) - { - List result = new ArrayList(); - for (int i = 0; i < mutableArray.length; i++) - { - result.add(new AnnotationEntryGen(mutableArray[i], getConstantPool(), - false)); - } - return result; - } - - public void addParameterAnnotation(int parameterIndex, - AnnotationEntryGen annotation) - { - ensureExistingParameterAnnotationsUnpacked(); - if (!hasParameterAnnotations) - { - param_annotations = new List[arg_types.length]; - hasParameterAnnotations = true; - } - List existingAnnotations = param_annotations[parameterIndex]; - if (existingAnnotations != null) - { - existingAnnotations.add(annotation); - } - else - { - List l = new ArrayList(); - l.add(annotation); - param_annotations[parameterIndex] = l; - } - } - - - - - /** - * @return Comparison strategy object - */ - public static BCELComparator getComparator() { - return _cmp; - } - - - /** - * @param comparator Comparison strategy object - */ - public static void setComparator( BCELComparator comparator ) { - _cmp = comparator; - } - - + + /** * Return value as defined by given BCELComparator strategy. * By default two MethodGen objects are said to be equal when diff --git a/java/org/apache/tomcat/util/bcel/generic/MethodObserver.java b/java/org/apache/tomcat/util/bcel/generic/MethodObserver.java deleted file mode 100644 index 15618f383..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/MethodObserver.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * Implement this interface if you're interested in changes to a MethodGen object - * and register yourself with addObserver(). - * - * @version $Id$ - * @author M. Dahm - */ -public interface MethodObserver { - - public void notify( MethodGen method ); -} diff --git a/java/org/apache/tomcat/util/bcel/generic/NEW.java b/java/org/apache/tomcat/util/bcel/generic/NEW.java index c88415432..749a4f0f3 100644 --- a/java/org/apache/tomcat/util/bcel/generic/NEW.java +++ b/java/org/apache/tomcat/util/bcel/generic/NEW.java @@ -16,8 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * NEW - Create new object *
Stack: ... -> ..., objectref@@ -36,22 +34,11 @@ public class NEW extends CPInstruction implements LoadClass, AllocationInstructi } - public NEW(int index) { - super(org.apache.tomcat.util.bcel.Constants.NEW, index); - } + - public Class[] getExceptions() { - Class[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); - cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length + 1] = ExceptionConstants.INSTANTIATION_ERROR; - cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.ILLEGAL_ACCESS_ERROR; - return cs; - } + - public ObjectType getLoadClassType( ConstantPoolGen cpg ) { - return (ObjectType) getType(cpg); - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/NEWARRAY.java b/java/org/apache/tomcat/util/bcel/generic/NEWARRAY.java index d983785eb..4019358d6 100644 --- a/java/org/apache/tomcat/util/bcel/generic/NEWARRAY.java +++ b/java/org/apache/tomcat/util/bcel/generic/NEWARRAY.java @@ -42,15 +42,10 @@ public class NEWARRAY extends Instruction implements AllocationInstruction, Exce } - public NEWARRAY(byte type) { - super(org.apache.tomcat.util.bcel.Constants.NEWARRAY, (short) 2); - this.type = type; - } + - public NEWARRAY(BasicType type) { - this(type.getType()); - } + /** @@ -71,12 +66,7 @@ public class NEWARRAY extends Instruction implements AllocationInstruction, Exce } - /** - * @return type of constructed array - */ - public final Type getType() { - return new ArrayType(BasicType.getType(type), 1); - } + /** @@ -96,9 +86,5 @@ public class NEWARRAY extends Instruction implements AllocationInstruction, Exce } - public Class[] getExceptions() { - return new Class[] { - org.apache.tomcat.util.bcel.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION - }; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/NOP.java b/java/org/apache/tomcat/util/bcel/generic/NOP.java deleted file mode 100644 index 75a1f57a4..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/NOP.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * NOP - Do nothing - * - * @version $Id$ - * @author M. Dahm - */ -public class NOP extends Instruction { - - public NOP() { - super(org.apache.tomcat.util.bcel.Constants.NOP, (short) 1); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/NamedAndTyped.java b/java/org/apache/tomcat/util/bcel/generic/NamedAndTyped.java index 68bbce2bd..053a8cb4e 100644 --- a/java/org/apache/tomcat/util/bcel/generic/NamedAndTyped.java +++ b/java/org/apache/tomcat/util/bcel/generic/NamedAndTyped.java @@ -28,7 +28,7 @@ public interface NamedAndTyped { public String getName(); - public Type getType(); + public void setName( String name ); diff --git a/java/org/apache/tomcat/util/bcel/generic/ObjectType.java b/java/org/apache/tomcat/util/bcel/generic/ObjectType.java index 7d7d803b8..59908ac66 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ObjectType.java +++ b/java/org/apache/tomcat/util/bcel/generic/ObjectType.java @@ -17,8 +17,6 @@ package org.apache.tomcat.util.bcel.generic; import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.Repository; -import org.apache.tomcat.util.bcel.classfile.JavaClass; /** * Denotes reference such as java.lang.String. @@ -63,93 +61,20 @@ public class ObjectType extends ReferenceType { } - /** - * If "this" doesn't reference a class, it references an interface - * or a non-existant entity. - * @deprecated this method returns an inaccurate result - * if the class or interface referenced cannot - * be found: use referencesClassExact() instead - */ - public boolean referencesClass() { - try { - JavaClass jc = Repository.lookupClass(class_name); - return jc.isClass(); - } catch (ClassNotFoundException e) { - return false; - } - } + - /** - * If "this" doesn't reference an interface, it references a class - * or a non-existant entity. - * @deprecated this method returns an inaccurate result - * if the class or interface referenced cannot - * be found: use referencesInterfaceExact() instead - */ - public boolean referencesInterface() { - try { - JavaClass jc = Repository.lookupClass(class_name); - return !jc.isClass(); - } catch (ClassNotFoundException e) { - return false; - } - } + - /** - * Return true if this type references a class, - * false if it references an interface. - * @return true if the type references a class, false if - * it references an interface - * @throws ClassNotFoundException if the class or interface - * referenced by this type can't be found - */ - public boolean referencesClassExact() throws ClassNotFoundException { - JavaClass jc = Repository.lookupClass(class_name); - return jc.isClass(); - } + - /** - * Return true if this type references an interface, - * false if it references a class. - * @return true if the type references an interface, false if - * it references a class - * @throws ClassNotFoundException if the class or interface - * referenced by this type can't be found - */ - public boolean referencesInterfaceExact() throws ClassNotFoundException { - JavaClass jc = Repository.lookupClass(class_name); - return !jc.isClass(); - } + - /** - * Return true if this type is a subclass of given ObjectType. - * @throws ClassNotFoundException if any of this class's superclasses - * can't be found - */ - public boolean subclassOf( ObjectType superclass ) throws ClassNotFoundException { - if (this.referencesInterface() || superclass.referencesInterface()) { - return false; - } - return Repository.instanceOf(this.class_name, superclass.class_name); - } + - /** - * Java Virtual Machine Specification edition 2, � 5.4.4 Access Control - * @throws ClassNotFoundException if the class referenced by this type - * can't be found - */ - public boolean accessibleTo( ObjectType accessor ) throws ClassNotFoundException { - JavaClass jc = Repository.lookupClass(class_name); - if (jc.isPublic()) { - return true; - } else { - JavaClass acc = Repository.lookupClass(accessor.class_name); - return acc.getPackageName().equals(jc.getPackageName()); - } - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/POP.java b/java/org/apache/tomcat/util/bcel/generic/POP.java deleted file mode 100644 index 9c6b77cdd..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/POP.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * POP - Pop top operand stack word - * - *
Stack: ..., word -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class POP extends StackInstruction implements PopInstruction { - - public POP() { - super(org.apache.tomcat.util.bcel.Constants.POP); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/POP2.java b/java/org/apache/tomcat/util/bcel/generic/POP2.java deleted file mode 100644 index 3db05f65f..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/POP2.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * POP2 - Pop two top operand stack words - * - *
Stack: ..., word2, word1 -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class POP2 extends StackInstruction implements PopInstruction { - - public POP2() { - super(org.apache.tomcat.util.bcel.Constants.POP2); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/PUSH.java b/java/org/apache/tomcat/util/bcel/generic/PUSH.java deleted file mode 100644 index d5c1329b3..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/PUSH.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -import org.apache.tomcat.util.bcel.Constants; - -/** - * Wrapper class for push operations, which are implemented either as BIPUSH, - * LDC or xCONST_n instructions. - * - * @version $Id$ - * @author M. Dahm - */ -public final class PUSH implements CompoundInstruction, VariableLengthInstruction, - InstructionConstants { - - private Instruction instruction; - - - /** - * This constructor also applies for values of type short, char, byte - * - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, int value) { - if ((value >= -1) && (value <= 5)) { - instruction = INSTRUCTIONS[Constants.ICONST_0 + value]; - } else if ((value >= -128) && (value <= 127)) { - instruction = new BIPUSH((byte) value); - } else if ((value >= -32768) && (value <= 32767)) { - instruction = new SIPUSH((short) value); - } else { - instruction = new LDC(cp.addInteger(value)); - } - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, boolean value) { - instruction = INSTRUCTIONS[Constants.ICONST_0 + (value ? 1 : 0)]; - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, float value) { - if (value == 0.0) { - instruction = FCONST_0; - } else if (value == 1.0) { - instruction = FCONST_1; - } else if (value == 2.0) { - instruction = FCONST_2; - } else { - instruction = new LDC(cp.addFloat(value)); - } - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, long value) { - if (value == 0) { - instruction = LCONST_0; - } else if (value == 1) { - instruction = LCONST_1; - } else { - instruction = new LDC2_W(cp.addLong(value)); - } - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, double value) { - if (value == 0.0) { - instruction = DCONST_0; - } else if (value == 1.0) { - instruction = DCONST_1; - } else { - instruction = new LDC2_W(cp.addDouble(value)); - } - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, String value) { - if (value == null) { - instruction = ACONST_NULL; - } else { - instruction = new LDC(cp.addString(value)); - } - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, Number value) { - if ((value instanceof Integer) || (value instanceof Short) || (value instanceof Byte)) { - instruction = new PUSH(cp, value.intValue()).instruction; - } else if (value instanceof Double) { - instruction = new PUSH(cp, value.doubleValue()).instruction; - } else if (value instanceof Float) { - instruction = new PUSH(cp, value.floatValue()).instruction; - } else if (value instanceof Long) { - instruction = new PUSH(cp, value.longValue()).instruction; - } else { - throw new ClassGenException("What's this: " + value); - } - } - - - /** - * creates a push object from a Character value. Warning: Make sure not to attempt to allow - * autoboxing to create this value parameter, as an alternative constructor will be called - * - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, Character value) { - this(cp, value.charValue()); - } - - - /** - * @param cp Constant pool - * @param value to be pushed - */ - public PUSH(ConstantPoolGen cp, Boolean value) { - this(cp, value.booleanValue()); - } - - - public final InstructionList getInstructionList() { - return new InstructionList(instruction); - } - - - public final Instruction getInstruction() { - return instruction; - } - - - /** - * @return mnemonic for instruction - */ - public String toString() { - return instruction.toString() + " (PUSH)"; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/PUTFIELD.java b/java/org/apache/tomcat/util/bcel/generic/PUTFIELD.java index c34c52c2c..d7eeba81e 100644 --- a/java/org/apache/tomcat/util/bcel/generic/PUTFIELD.java +++ b/java/org/apache/tomcat/util/bcel/generic/PUTFIELD.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * PUTFIELD - Put field in object *
Stack: ..., objectref, value -> ...@@ -38,9 +35,7 @@ public class PUTFIELD extends FieldInstruction implements PopInstruction, Except } - public PUTFIELD(int index) { - super(Constants.PUTFIELD, index); - } + public int consumeStack( ConstantPoolGen cpg ) { @@ -48,12 +43,5 @@ public class PUTFIELD extends FieldInstruction implements PopInstruction, Except } - public Class[] getExceptions() { - Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/PUTSTATIC.java b/java/org/apache/tomcat/util/bcel/generic/PUTSTATIC.java index ce52249b7..251b2d19d 100644 --- a/java/org/apache/tomcat/util/bcel/generic/PUTSTATIC.java +++ b/java/org/apache/tomcat/util/bcel/generic/PUTSTATIC.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.bcel.generic; -import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.ExceptionConstants; - /** * PUTSTATIC - Put static field in class *
Stack: ..., value -> ...@@ -38,9 +35,7 @@ public class PUTSTATIC extends FieldInstruction implements ExceptionThrower, Pop } - public PUTSTATIC(int index) { - super(Constants.PUTSTATIC, index); - } + public int consumeStack( ConstantPoolGen cpg ) { @@ -48,11 +43,5 @@ public class PUTSTATIC extends FieldInstruction implements ExceptionThrower, Pop } - public Class[] getExceptions() { - Class[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; - System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, - ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); - cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; - return cs; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/RET.java b/java/org/apache/tomcat/util/bcel/generic/RET.java index 0bf095c90..573d31159 100644 --- a/java/org/apache/tomcat/util/bcel/generic/RET.java +++ b/java/org/apache/tomcat/util/bcel/generic/RET.java @@ -42,10 +42,7 @@ public class RET extends Instruction implements IndexedInstruction, TypedInstruc } - public RET(int index) { - super(org.apache.tomcat.util.bcel.Constants.RET, (short) 2); - setIndex(index); // May set wide as side effect - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/RETURN.java b/java/org/apache/tomcat/util/bcel/generic/RETURN.java deleted file mode 100644 index e9f25c904..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/RETURN.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * RETURN - Return from void method - *
Stack: ... -> <empty>- * - * @version $Id$ - * @author M. Dahm - */ -public class RETURN extends ReturnInstruction { - - public RETURN() { - super(org.apache.tomcat.util.bcel.Constants.RETURN); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/ReferenceType.java b/java/org/apache/tomcat/util/bcel/generic/ReferenceType.java index f9cab4c6e..74d05276a 100644 --- a/java/org/apache/tomcat/util/bcel/generic/ReferenceType.java +++ b/java/org/apache/tomcat/util/bcel/generic/ReferenceType.java @@ -17,8 +17,6 @@ package org.apache.tomcat.util.bcel.generic; import org.apache.tomcat.util.bcel.Constants; -import org.apache.tomcat.util.bcel.Repository; -import org.apache.tomcat.util.bcel.classfile.JavaClass; /** * Super class for object and array types. @@ -40,291 +38,14 @@ public abstract class ReferenceType extends Type { } - /** - * Return true iff this type is castable to another type t as defined in - * the JVM specification. The case where this is Type.NULL is not - * defined (see the CHECKCAST definition in the JVM specification). - * However, because e.g. CHECKCAST doesn't throw a - * ClassCastException when casting a null reference to any Object, - * true is returned in this case. - * - * @throws ClassNotFoundException if any classes or interfaces required - * to determine assignment compatibility can't be found - */ - public boolean isCastableTo( Type t ) throws ClassNotFoundException { - if (this.equals(Type.NULL)) { - return true; // If this is ever changed in isAssignmentCompatible() - } - return isAssignmentCompatibleWith(t); - /* Yes, it's true: It's the same definition. - * See vmspec2 AASTORE / CHECKCAST definitions. - */ - } + - /** - * Return true iff this is assignment compatible with another type t - * as defined in the JVM specification; see the AASTORE definition - * there. - * @throws ClassNotFoundException if any classes or interfaces required - * to determine assignment compatibility can't be found - */ - public boolean isAssignmentCompatibleWith( Type t ) throws ClassNotFoundException { - if (!(t instanceof ReferenceType)) { - return false; - } - ReferenceType T = (ReferenceType) t; - if (this.equals(Type.NULL)) { - return true; // This is not explicitely stated, but clear. Isn't it? - } - /* If this is a class type then - */ - if ((this instanceof ObjectType) && (((ObjectType) this).referencesClassExact())) { - /* If T is a class type, then this must be the same class as T, - or this must be a subclass of T; - */ - if ((T instanceof ObjectType) && (((ObjectType) T).referencesClassExact())) { - if (this.equals(T)) { - return true; - } - if (Repository.instanceOf(((ObjectType) this).getClassName(), ((ObjectType) T) - .getClassName())) { - return true; - } - } - /* If T is an interface type, this must implement interface T. - */ - if ((T instanceof ObjectType) && (((ObjectType) T).referencesInterfaceExact())) { - if (Repository.implementationOf(((ObjectType) this).getClassName(), - ((ObjectType) T).getClassName())) { - return true; - } - } - } - /* If this is an interface type, then: - */ - if ((this instanceof ObjectType) && (((ObjectType) this).referencesInterfaceExact())) { - /* If T is a class type, then T must be Object (�2.4.7). - */ - if ((T instanceof ObjectType) && (((ObjectType) T).referencesClassExact())) { - if (T.equals(Type.OBJECT)) { - return true; - } - } - /* If T is an interface type, then T must be the same interface - * as this or a superinterface of this (�2.13.2). - */ - if ((T instanceof ObjectType) && (((ObjectType) T).referencesInterfaceExact())) { - if (this.equals(T)) { - return true; - } - if (Repository.implementationOf(((ObjectType) this).getClassName(), - ((ObjectType) T).getClassName())) { - return true; - } - } - } - /* If this is an array type, namely, the type SC[], that is, an - * array of components of type SC, then: - */ - if (this instanceof ArrayType) { - /* If T is a class type, then T must be Object (�2.4.7). - */ - if ((T instanceof ObjectType) && (((ObjectType) T).referencesClassExact())) { - if (T.equals(Type.OBJECT)) { - return true; - } - } - /* If T is an array type TC[], that is, an array of components - * of type TC, then one of the following must be true: - */ - if (T instanceof ArrayType) { - /* TC and SC are the same primitive type (�2.4.1). - */ - Type sc = ((ArrayType) this).getElementType(); - Type tc = ((ArrayType) T).getElementType(); - if (sc instanceof BasicType && tc instanceof BasicType && sc.equals(tc)) { - return true; - } - /* TC and SC are reference types (�2.4.6), and type SC is - * assignable to TC by these runtime rules. - */ - if (tc instanceof ReferenceType && sc instanceof ReferenceType - && ((ReferenceType) sc).isAssignmentCompatibleWith(tc)) { - return true; - } - } - /* If T is an interface type, T must be one of the interfaces implemented by arrays (�2.15). */ - // TODO: Check if this is still valid or find a way to dynamically find out which - // interfaces arrays implement. However, as of the JVM specification edition 2, there - // are at least two different pages where assignment compatibility is defined and - // on one of them "interfaces implemented by arrays" is exchanged with "'Cloneable' or - // 'java.io.Serializable'" - if ((T instanceof ObjectType) && (((ObjectType) T).referencesInterfaceExact())) { - for (int ii = 0; ii < Constants.INTERFACES_IMPLEMENTED_BY_ARRAYS.length; ii++) { - if (T.equals(new ObjectType(Constants.INTERFACES_IMPLEMENTED_BY_ARRAYS[ii]))) { - return true; - } - } - } - } - return false; // default. - } + - /** - * This commutative operation returns the first common superclass (narrowest ReferenceType - * referencing a class, not an interface). - * If one of the types is a superclass of the other, the former is returned. - * If "this" is Type.NULL, then t is returned. - * If t is Type.NULL, then "this" is returned. - * If "this" equals t ['this.equals(t)'] "this" is returned. - * If "this" or t is an ArrayType, then Type.OBJECT is returned; - * unless their dimensions match. Then an ArrayType of the same - * number of dimensions is returned, with its basic type being the - * first common super class of the basic types of "this" and t. - * If "this" or t is a ReferenceType referencing an interface, then Type.OBJECT is returned. - * If not all of the two classes' superclasses cannot be found, "null" is returned. - * See the JVM specification edition 2, "�4.9.2 The Bytecode Verifier". - * - * @throws ClassNotFoundException on failure to find superclasses of this - * type, or the type passed as a parameter - */ - public ReferenceType getFirstCommonSuperclass( ReferenceType t ) throws ClassNotFoundException { - if (this.equals(Type.NULL)) { - return t; - } - if (t.equals(Type.NULL)) { - return this; - } - if (this.equals(t)) { - return this; - /* - * TODO: Above sounds a little arbitrary. On the other hand, there is - * no object referenced by Type.NULL so we can also say all the objects - * referenced by Type.NULL were derived from java.lang.Object. - * However, the Java Language's "instanceof" operator proves us wrong: - * "null" is not referring to an instance of java.lang.Object :) - */ - } - /* This code is from a bug report by Konstantin Shagin
Stack: ..., arrayref, index -> ..., value- * - * @version $Id$ - * @author M. Dahm - */ -public class SALOAD extends ArrayInstruction implements StackProducer { - - public SALOAD() { - super(org.apache.tomcat.util.bcel.Constants.SALOAD); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/SASTORE.java b/java/org/apache/tomcat/util/bcel/generic/SASTORE.java deleted file mode 100644 index 94c1b8c7f..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/SASTORE.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * SASTORE - Store into short array - *
Stack: ..., arrayref, index, value -> ...- * - * @version $Id$ - * @author M. Dahm - */ -public class SASTORE extends ArrayInstruction implements StackConsumer { - - public SASTORE() { - super(org.apache.tomcat.util.bcel.Constants.SASTORE); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/SIPUSH.java b/java/org/apache/tomcat/util/bcel/generic/SIPUSH.java index 85448a7e1..936773906 100644 --- a/java/org/apache/tomcat/util/bcel/generic/SIPUSH.java +++ b/java/org/apache/tomcat/util/bcel/generic/SIPUSH.java @@ -41,10 +41,7 @@ public class SIPUSH extends Instruction implements ConstantPushInstruction { } - public SIPUSH(short b) { - super(org.apache.tomcat.util.bcel.Constants.SIPUSH, (short) 3); - this.b = b; - } + /** @@ -78,9 +75,5 @@ public class SIPUSH extends Instruction implements ConstantPushInstruction { } - /** @return Type.SHORT - */ - public Type getType( ConstantPoolGen cp ) { - return Type.SHORT; - } + } diff --git a/java/org/apache/tomcat/util/bcel/generic/SWAP.java b/java/org/apache/tomcat/util/bcel/generic/SWAP.java deleted file mode 100644 index abc3432c0..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/SWAP.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * SWAP - Swa top operand stack word - *
Stack: ..., word2, word1 -> ..., word1, word2- * - * @version $Id$ - * @author M. Dahm - */ -public class SWAP extends StackInstruction implements StackConsumer, StackProducer { - - public SWAP() { - super(org.apache.tomcat.util.bcel.Constants.SWAP); - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/Select.java b/java/org/apache/tomcat/util/bcel/generic/Select.java index aef247c2b..c6c244618 100644 --- a/java/org/apache/tomcat/util/bcel/generic/Select.java +++ b/java/org/apache/tomcat/util/bcel/generic/Select.java @@ -50,26 +50,7 @@ public abstract class Select extends BranchInstruction implements VariableLength } - /** - * (Match, target) pairs for switch. - * `Match' and `targets' must have the same length of course. - * - * @param match array of matching values - * @param targets instruction targets - * @param defaultTarget default instruction target - */ - Select(short opcode, int[] match, InstructionHandle[] targets, InstructionHandle defaultTarget) { - super(opcode, defaultTarget); - this.targets = targets; - for (int i = 0; i < targets.length; i++) { - notifyTarget(null, targets[i], this); - } - this.match = match; - if ((match_length = match.length) != targets.length) { - throw new ClassGenException("Match and target array have not the same length: Match length: " + match.length + " Target length: " + targets.length); - } - indices = new int[match_length]; - } + /** @@ -211,12 +192,7 @@ public abstract class Select extends BranchInstruction implements VariableLength } - /** - * @return array of match indices - */ - public int[] getMatchs() { - return match; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/SimpleElementValueGen.java b/java/org/apache/tomcat/util/bcel/generic/SimpleElementValueGen.java index e1ae11b2b..568a3f687 100644 --- a/java/org/apache/tomcat/util/bcel/generic/SimpleElementValueGen.java +++ b/java/org/apache/tomcat/util/bcel/generic/SimpleElementValueGen.java @@ -17,74 +17,25 @@ public class SimpleElementValueGen extends ElementValueGen // For 'class' this points to the class entry in the cpGen private int idx; - // ctors for each supported type... type could be inferred but for now lets - // force it to be passed - /** - * Protected ctor used for deserialization, doesn't *put* an entry in the - * constant pool, assumes the one at the supplied index is correct. - */ - protected SimpleElementValueGen(int type, int idx, ConstantPoolGen cpGen) - { - super(type, cpGen); - this.idx = idx; - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, int value) - { - super(type, cpGen); - idx = cpGen.addInteger(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, long value) - { - super(type, cpGen); - idx = cpGen.addLong(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, double value) - { - super(type, cpGen); - idx = cpGen.addDouble(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, float value) - { - super(type, cpGen); - idx = cpGen.addFloat(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, short value) - { - super(type, cpGen); - idx = cpGen.addInteger(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, byte value) - { - super(type, cpGen); - idx = cpGen.addInteger(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, char value) - { - super(type, cpGen); - idx = cpGen.addInteger(value); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, boolean value) - { - super(type, cpGen); - if (value) - idx = cpGen.addInteger(1); - else - idx = cpGen.addInteger(0); - } + - public SimpleElementValueGen(int type, ConstantPoolGen cpGen, String value) - { - super(type, cpGen); - idx = cpGen.addUtf8(value); - } + /** * The boolean controls whether we copy info from the 'old' constant pool to @@ -155,28 +106,11 @@ public class SimpleElementValueGen extends ElementValueGen return new SimpleElementValue(type, idx, cpGen.getConstantPool()); } - public int getIndex() - { - return idx; - } + - public String getValueString() - { - if (type != STRING) - throw new RuntimeException( - "Dont call getValueString() on a non STRING ElementValue"); - ConstantUtf8 c = (ConstantUtf8) cpGen.getConstant(idx); - return c.getBytes(); - } + - public int getValueInt() - { - if (type != PRIMITIVE_INT) - throw new RuntimeException( - "Dont call getValueString() on a non STRING ElementValue"); - ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx); - return c.getBytes(); - } + // Whatever kind of value it is, return it as a string public String stringifyValue() diff --git a/java/org/apache/tomcat/util/bcel/generic/StackConsumer.java b/java/org/apache/tomcat/util/bcel/generic/StackConsumer.java index 990f5757b..b02cce443 100644 --- a/java/org/apache/tomcat/util/bcel/generic/StackConsumer.java +++ b/java/org/apache/tomcat/util/bcel/generic/StackConsumer.java @@ -24,7 +24,5 @@ package org.apache.tomcat.util.bcel.generic; */ public interface StackConsumer { - /** @return how many words are consumed from stack - */ - public int consumeStack( ConstantPoolGen cpg ); + } diff --git a/java/org/apache/tomcat/util/bcel/generic/StackInstruction.java b/java/org/apache/tomcat/util/bcel/generic/StackInstruction.java deleted file mode 100644 index 5d7bf76fb..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/StackInstruction.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * Super class for stack operations like DUP and POP. - * - * @version $Id$ - * @author M. Dahm - */ -public abstract class StackInstruction extends Instruction { - - /** - * Empty constructor needed for the Class.newInstance() statement in - * Instruction.readInstruction(). Not to be used otherwise. - */ - StackInstruction() { - } - - - /** - * @param opcode instruction opcode - */ - protected StackInstruction(short opcode) { - super(opcode, (short) 1); - } - - - /** @return Type.UNKNOWN - */ - public Type getType( ConstantPoolGen cp ) { - return Type.UNKNOWN; - } -} diff --git a/java/org/apache/tomcat/util/bcel/generic/StackProducer.java b/java/org/apache/tomcat/util/bcel/generic/StackProducer.java index 04a32beb9..6a4f2f5c9 100644 --- a/java/org/apache/tomcat/util/bcel/generic/StackProducer.java +++ b/java/org/apache/tomcat/util/bcel/generic/StackProducer.java @@ -25,7 +25,5 @@ package org.apache.tomcat.util.bcel.generic; */ public interface StackProducer { - /** @return how many words are produced on stack - */ - public int produceStack( ConstantPoolGen cpg ); + } diff --git a/java/org/apache/tomcat/util/bcel/generic/TABLESWITCH.java b/java/org/apache/tomcat/util/bcel/generic/TABLESWITCH.java index 2d2e7134a..35dc981e6 100644 --- a/java/org/apache/tomcat/util/bcel/generic/TABLESWITCH.java +++ b/java/org/apache/tomcat/util/bcel/generic/TABLESWITCH.java @@ -37,18 +37,7 @@ public class TABLESWITCH extends Select { } - /** - * @param match sorted array of match values, match[0] must be low value, - * match[match_length - 1] high value - * @param targets where to branch for matched values - * @param defaultTarget default branch - */ - public TABLESWITCH(int[] match, InstructionHandle[] targets, InstructionHandle defaultTarget) { - super(org.apache.tomcat.util.bcel.Constants.TABLESWITCH, match, targets, defaultTarget); - length = (short) (13 + match_length * 4); /* Alignment remainder assumed - * 0 here, until dump time */ - fixed_length = length; - } + /** diff --git a/java/org/apache/tomcat/util/bcel/generic/TargetLostException.java b/java/org/apache/tomcat/util/bcel/generic/TargetLostException.java deleted file mode 100644 index dd7c993ed..000000000 --- a/java/org/apache/tomcat/util/bcel/generic/TargetLostException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2000-2009 The Apache Software Foundation - * - * Licensed 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.tomcat.util.bcel.generic; - -/** - * Thrown by InstructionList.remove() when one or multiple disposed instruction - * are still being referenced by a InstructionTargeter object. I.e. the - * InstructionTargeter has to be notified that (one of) the InstructionHandle it - * is referencing is being removed from the InstructionList and thus not valid anymore. - * - * Making this an exception instead of a return value forces the user to handle - * these case explicitely in a try { ... } catch. The following code illustrates - * how this may be done: - * - *
- * ...
- * try {
- * il.delete(start_ih, end_ih);
- * } catch(TargetLostException e) {
- * InstructionHandle[] targets = e.getTargets();
- * for(int i=0; i < targets.length; i++) {
- * InstructionTargeter[] targeters = targets[i].getTargeters();
- *
- * for(int j=0; j < targeters.length; j++)
- * targeters[j].updateTarget(targets[i], new_target);
- * }
- * }
- *
- *
- * @see InstructionHandle
- * @see InstructionList
- * @see InstructionTargeter
- * @version $Id$
- * @author M. Dahm
- */
-public final class TargetLostException extends Exception {
-
- private InstructionHandle[] targets;
-
-
- TargetLostException(InstructionHandle[] t, String mesg) {
- super(mesg);
- targets = t;
- }
-
-
- /**
- * @return list of instructions still being targeted.
- */
- public InstructionHandle[] getTargets() {
- return targets;
- }
-}
diff --git a/java/org/apache/tomcat/util/bcel/generic/Type.java b/java/org/apache/tomcat/util/bcel/generic/Type.java
index 1c5d51310..1ede105e8 100644
--- a/java/org/apache/tomcat/util/bcel/generic/Type.java
+++ b/java/org/apache/tomcat/util/bcel/generic/Type.java
@@ -16,8 +16,6 @@
*/
package org.apache.tomcat.util.bcel.generic;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.tomcat.util.bcel.Constants;
import org.apache.tomcat.util.bcel.classfile.ClassFormatException;
import org.apache.tomcat.util.bcel.classfile.Utility;
@@ -47,13 +45,12 @@ public abstract class Type implements java.io.Serializable {
public static final ObjectType OBJECT = new ObjectType("java.lang.Object");
public static final ObjectType CLASS = new ObjectType("java.lang.Class");
public static final ObjectType STRING = new ObjectType("java.lang.String");
- public static final ObjectType STRINGBUFFER = new ObjectType("java.lang.StringBuffer");
- public static final ObjectType THROWABLE = new ObjectType("java.lang.Throwable");
- public static final Type[] NO_ARGS = new Type[0];
+
+
+
public static final ReferenceType NULL = new ReferenceType() {
};
- public static final Type UNKNOWN = new Type(Constants.T_UNKNOWN, "