You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/25 20:45:22 UTC
svn commit: r1697755 - in
/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6: ./
classfile/ generic/ util/
Author: sebb
Date: Tue Aug 25 18:45:21 2015
New Revision: 1697755
URL: http://svn.apache.org/r1697755
Log:
Prepare for eventual privatisation of other array constants
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/Constants.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Deprecated.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Utility.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BasicType.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEWARRAY.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/AttributeHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELifier.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/CodeHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ConstantHTML.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/InstructionFinder.java
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/Constants.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/Constants.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/Constants.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/Constants.java Tue Aug 25 18:45:21 2015
@@ -236,13 +236,31 @@ public final class Constants {
*/
public static final short MAX_ACC_FLAG = ACC_ENUM;
- /** The names of the access flags. */
+ /**
+ * The names of the access flags.
+ * @deprecated Do not use as will be made private.
+ * Use getAccessName instead
+ */
+ @Deprecated
public static final String[] ACCESS_NAMES = {
"public", "private", "protected", "static", "final", "synchronized",
"volatile", "transient", "native", "interface", "abstract", "strictfp",
"synthetic", "annotation", "enum"
};
+ /** @since 6.0 */
+ public static final int ACCESS_NAMES_LENGTH = ACCESS_NAMES.length;
+
+ /**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getAccessName(int index) {
+ return ACCESS_NAMES[index];
+ }
+
/** Marks a constant pool entry as type UTF-8.
* @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4">
* The Constant Pool in The Java Virtual Machine Specification</a> */
@@ -313,7 +331,12 @@ public final class Constants {
* The Constant Pool in The Java Virtual Machine Specification</a> */
public static final byte CONSTANT_InvokeDynamic = 18;
- /** The names of the types of entries in a constant pool. */
+ /**
+ * The names of the types of entries in a constant pool.
+ * @deprecated Do not use as will be made private.
+ * Use getConstantName instead
+ */
+ @Deprecated
public static final String[] CONSTANT_NAMES = {
"", "CONSTANT_Utf8", "", "CONSTANT_Integer",
"CONSTANT_Float", "CONSTANT_Long", "CONSTANT_Double",
@@ -322,6 +345,16 @@ public final class Constants {
"CONSTANT_NameAndType", "", "", "CONSTANT_MethodHandle",
"CONSTANT_MethodType", "", "CONSTANT_InvokeDynamic" };
+ /**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getConstantName(int index) {
+ return CONSTANT_NAMES[index];
+ }
+
/** The name of the static initializer, also called "class
* initialization method" or "interface initialization
* method". This is "<clinit>".
@@ -333,10 +366,25 @@ public final class Constants {
*/
public static final String CONSTRUCTOR_NAME = "<init>";
- /** The names of the interfaces implemented by arrays */
+ /**
+ * The names of the interfaces implemented by arrays
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
+ */
+ @Deprecated
public static final String[] INTERFACES_IMPLEMENTED_BY_ARRAYS = {"java.lang.Cloneable", "java.io.Serializable"};
/**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getConstasntName(int index) {
+ return INTERFACES_IMPLEMENTED_BY_ARRAYS[index];
+ }
+
+ /**
* Maximum Constant Pool entries.
* One of the limitations of the Java Virtual Machine.
* @see <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.11-100-A">
@@ -1431,16 +1479,32 @@ public final class Constants {
/** The primitive type names corresponding to the T_XX constants,
* e.g., TYPE_NAMES[T_INT] = "int"
+ * @deprecated Do not use as will be made private.
+ * Use getTypeName instead
*/
+ @Deprecated
public static final String[] TYPE_NAMES = {
ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
"boolean", "char", "float", "double", "byte", "short", "int", "long",
"void", "array", "object", "unknown", "address"
};
+ /**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getTypeName(int index) {
+ return TYPE_NAMES[index];
+ }
+
/** The primitive class names corresponding to the T_XX constants,
* e.g., CLASS_TYPE_NAMES[T_INT] = "java.lang.Integer"
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
*/
+ @Deprecated
public static final String[] CLASS_TYPE_NAMES = {
ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
"java.lang.Boolean", "java.lang.Character", "java.lang.Float",
@@ -1451,7 +1515,10 @@ public final class Constants {
/** The signature characters corresponding to primitive types,
* e.g., SHORT_TYPE_NAMES[T_INT] = "I"
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
*/
+ @Deprecated
public static final String[] SHORT_TYPE_NAMES = {
ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
"Z", "C", "F", "D", "B", "S", "I", "J",
@@ -1459,10 +1526,24 @@ public final class Constants {
};
/**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getShortTypeName(int index) {
+ return SHORT_TYPE_NAMES[index];
+ }
+
+
+ /**
* Number of byte code operands for each opcode, i.e., number of bytes after the tag byte
* itself. Indexed by opcode, so NO_OF_OPERANDS[BIPUSH] = the number of operands for a bipush
* instruction.
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
*/
+ @Deprecated
public static final short[] NO_OF_OPERANDS = {
0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/,
0/*iconst_1*/, 0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/,
@@ -1525,6 +1606,16 @@ public final class Constants {
};
/**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static short getNoOfOperands(int index) {
+ return NO_OF_OPERANDS[index];
+ }
+
+ /**
* How the byte code operands are to be interpreted for each opcode.
* Indexed by opcode. TYPE_OF_OPERANDS[ILOAD] = an array of shorts
* describing the data types for the instruction.
@@ -1681,7 +1772,10 @@ public final class Constants {
* Number of words consumed on operand stack by instructions.
* Indexed by opcode. CONSUME_STACK[FALOAD] = number of words
* consumed from the stack by a faload instruction.
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
*/
+ @Deprecated
public static final int[] CONSUME_STACK = {
0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/, 0/*iconst_1*/,
0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/, 0/*iconst_5*/, 0/*lconst_0*/,
@@ -1734,10 +1828,24 @@ public final class Constants {
};
/**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static int getConsumeStack(int index) {
+ return CONSUME_STACK[index];
+ }
+
+
+ /**
* Number of words produced onto operand stack by instructions.
* Indexed by opcode. CONSUME_STACK[DALOAD] = number of words
* consumed from the stack by a daload instruction.
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
*/
+ @Deprecated
public static final int[] PRODUCE_STACK = {
0/*nop*/, 1/*aconst_null*/, 1/*iconst_m1*/, 1/*iconst_0*/, 1/*iconst_1*/,
1/*iconst_2*/, 1/*iconst_3*/, 1/*iconst_4*/, 1/*iconst_5*/, 2/*lconst_0*/,
@@ -1789,6 +1897,16 @@ public final class Constants {
UNDEFINED, UNPREDICTABLE/*impdep1*/, UNPREDICTABLE/*impdep2*/
};
+ /**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static int getProduceStack(int index) {
+ return PRODUCE_STACK[index];
+ }
+
/** Attributes and their corresponding names.
*/
public static final byte ATTR_UNKNOWN = -1;
@@ -1817,7 +1935,12 @@ public final class Constants {
public static final short KNOWN_ATTRIBUTES = 22; // count of attributes
- // TODO: mutable public array!!
+ /**
+ *
+ * @deprecated Do not use as will be made private.
+ * Use getAttributeName instead
+ */
+ @Deprecated
public static final String[] ATTRIBUTE_NAMES = {
"SourceFile", "ConstantValue", "Code", "Exceptions",
"LineNumberTable", "LocalVariableTable",
@@ -1829,6 +1952,16 @@ public final class Constants {
"BootstrapMethods", "MethodParameters"
};
+ /**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getAttributeName(int index) {
+ return ATTRIBUTE_NAMES[index];
+ }
+
/** Constants used in the StackMap attribute.
*/
public static final byte ITEM_Bogus = 0;
@@ -1841,11 +1974,26 @@ public final class Constants {
public static final byte ITEM_Object = 7;
public static final byte ITEM_NewObject = 8;
+ /**
+ * @deprecated Do not use as will be made private.
+ * Use TBA instead
+ */
+ @Deprecated
public static final String[] ITEM_NAMES = {
"Bogus", "Integer", "Float", "Double", "Long",
"Null", "InitObject", "Object", "NewObject"
};
+ /**
+ *
+ * @param index
+ * @return
+ * @since 6.0
+ */
+ public static String getItemName(int index) {
+ return ITEM_NAMES[index];
+ }
+
/** Constants used to identify StackMapEntry types.
*
* For those types which can specify a range, the
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java Tue Aug 25 18:45:21 2015
@@ -180,7 +180,7 @@ public abstract class Attribute implemen
// Compare strings to find known attribute
for (byte i = 0; i < Constants.KNOWN_ATTRIBUTES; i++)
{
- if (name.equals(Constants.ATTRIBUTE_NAMES[i]))
+ if (name.equals(Constants.getAttributeName(i)))
{
tag = i; // found!
break;
@@ -347,6 +347,6 @@ public abstract class Attribute implemen
@Override
public String toString()
{
- return Constants.ATTRIBUTE_NAMES[tag];
+ return Constants.getAttributeName(tag);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java Tue Aug 25 18:45:21 2015
@@ -97,7 +97,7 @@ public abstract class Constant implement
*/
@Override
public String toString() {
- return Constants.CONSTANT_NAMES[tag] + "[" + tag + "]";
+ return Constants.getConstantName(tag) + "[" + tag + "]";
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantPool.java Tue Aug 25 18:45:21 2015
@@ -258,7 +258,7 @@ public class ConstantPool implements Clo
throw new ClassFormatException("Constant pool at index " + index + " is null.");
}
if (c.getTag() != tag) {
- throw new ClassFormatException("Expected class `" + Constants.CONSTANT_NAMES[tag]
+ throw new ClassFormatException("Expected class `" + Constants.getConstantName(tag)
+ "' at index " + index + " and got " + c);
}
return c;
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Deprecated.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Deprecated.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Deprecated.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Deprecated.java Tue Aug 25 18:45:21 2015
@@ -126,7 +126,7 @@ public final class Deprecated extends At
*/
@Override
public final String toString() {
- return Constants.ATTRIBUTE_NAMES[Constants.ATTR_DEPRECATED];
+ return Constants.getAttributeName(Constants.ATTR_DEPRECATED);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java Tue Aug 25 18:45:21 2015
@@ -133,7 +133,7 @@ public final class StackMapType implemen
*/
@Override
public final String toString() {
- return "(type=" + Constants.ITEM_NAMES[type] + printIndex() + ")";
+ return "(type=" + Constants.getItemName(type) + printIndex() + ")";
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Utility.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Utility.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Utility.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Utility.java Tue Aug 25 18:45:21 2015
@@ -113,7 +113,7 @@ public abstract class Utility {
if (for_class && ((p == Constants.ACC_SUPER) || (p == Constants.ACC_INTERFACE))) {
continue;
}
- buf.append(Constants.ACCESS_NAMES[i]).append(" ");
+ buf.append(Constants.getAccessName(i)).append(" ");
}
}
return buf.toString().trim();
@@ -318,7 +318,7 @@ public abstract class Utility {
/* Array of basic type.
*/
case Constants.NEWARRAY:
- buf.append("\t\t<").append(Constants.TYPE_NAMES[bytes.readByte()]).append(">");
+ buf.append("\t\t<").append(Constants.getTypeName(bytes.readByte())).append(">");
break;
/* Access object/class fields.
*/
@@ -428,7 +428,7 @@ public abstract class Utility {
buf.append("\t\t%").append(vindex).append("\t").append(constant);
break;
default:
- if (Constants.NO_OF_OPERANDS[opcode] > 0) {
+ if (Constants.getNoOfOperands(opcode) > 0) {
for (int i = 0; i < Constants.getOperandTypeCount(opcode); i++) {
buf.append("\t\t");
switch (Constants.getOperandType(opcode, i)) {
@@ -987,9 +987,9 @@ public abstract class Utility {
}
boolean found = false;
for (int i = Constants.T_BOOLEAN; (i <= Constants.T_VOID) && !found; i++) {
- if (Constants.TYPE_NAMES[i].equals(type)) {
+ if (Constants.getTypeName(i).equals(type)) {
found = true;
- buf.append(Constants.SHORT_TYPE_NAMES[i]);
+ buf.append(Constants.getShortTypeName(i));
}
}
if (!found) {
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BasicType.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BasicType.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BasicType.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/BasicType.java Tue Aug 25 18:45:21 2015
@@ -33,7 +33,7 @@ public final class BasicType extends Typ
* @see Constants
*/
BasicType(byte type) {
- super(type, Constants.SHORT_TYPE_NAMES[type]);
+ super(type, Constants.getShortTypeName(type));
if ((type < Constants.T_BOOLEAN) || (type > Constants.T_VOID)) {
throw new ClassGenException("Invalid type: " + type);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Instruction.java Tue Aug 25 18:45:21 2015
@@ -480,7 +480,7 @@ public abstract class Instruction implem
* or Constants.UNPREDICTABLE, if this can not be computed statically
*/
public int consumeStack( ConstantPoolGen cpg ) {
- return Constants.CONSUME_STACK[opcode];
+ return Constants.getConsumeStack(opcode);
}
@@ -492,7 +492,7 @@ public abstract class Instruction implem
* or Constants.UNPREDICTABLE, if this can not be computed statically
*/
public int produceStack( ConstantPoolGen cpg ) {
- return Constants.PRODUCE_STACK[opcode];
+ return Constants.getProduceStack(opcode);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEWARRAY.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEWARRAY.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEWARRAY.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEWARRAY.java Tue Aug 25 18:45:21 2015
@@ -86,7 +86,7 @@ public class NEWARRAY extends Instructio
*/
@Override
public String toString( boolean verbose ) {
- return super.toString(verbose) + " " + org.apache.commons.bcel6.Constants.TYPE_NAMES[type];
+ return super.toString(verbose) + " " + org.apache.commons.bcel6.Constants.getTypeName(type);
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/AttributeHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/AttributeHTML.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/AttributeHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/AttributeHTML.java Tue Aug 25 18:45:21 2015
@@ -92,7 +92,7 @@ final class AttributeHTML {
} else {
file.print("<TR BGCOLOR=\"#A0A0A0\"><TD>");
}
- file.println("<H4><A NAME=\"" + anchor + "\">" + attr_count + " " + Constants.ATTRIBUTE_NAMES[tag]
+ file.println("<H4><A NAME=\"" + anchor + "\">" + attr_count + " " + Constants.getAttributeName(tag)
+ "</A></H4>");
/* Handle different attributes
*/
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELifier.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELifier.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELifier.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/BCELifier.java Tue Aug 25 18:45:21 2015
@@ -217,8 +217,8 @@ public class BCELifier extends org.apach
} else if ((pow == Constants.ACC_TRANSIENT) && (location == FLAGS.METHOD)) {
buf.append("ACC_VARARGS | ");
} else {
- if (i < Constants.ACCESS_NAMES.length) {
- buf.append("ACC_").append(Constants.ACCESS_NAMES[i].toUpperCase(Locale.ENGLISH)).append( " | ");
+ if (i < Constants.ACCESS_NAMES_LENGTH) {
+ buf.append("ACC_").append(Constants.getAccessName(i).toUpperCase(Locale.ENGLISH)).append( " | ");
} else {
buf.append(String.format ("ACC_BIT %x | ", pow));
}
@@ -255,7 +255,7 @@ public class BCELifier extends org.apach
Type type = Type.getType(signature);
byte t = type.getType();
if (t <= Constants.T_VOID) {
- return "Type." + Constants.TYPE_NAMES[t].toUpperCase(Locale.ENGLISH);
+ return "Type." + Constants.getTypeName(t).toUpperCase(Locale.ENGLISH);
} else if (type.toString().equals("java.lang.String")) {
return "Type.STRING";
} else if (type.toString().equals("java.lang.Object")) {
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/CodeHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/CodeHTML.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/CodeHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/CodeHTML.java Tue Aug 25 18:45:21 2015
@@ -218,7 +218,7 @@ final class CodeHTML {
/* Array of basic type.
*/
case Constants.NEWARRAY:
- buf.append("<FONT COLOR=\"#00FF00\">").append(Constants.TYPE_NAMES[bytes.readByte()]).append(
+ buf.append("<FONT COLOR=\"#00FF00\">").append(Constants.getTypeName(bytes.readByte())).append(
"</FONT>");
break;
/* Access object/class fields.
@@ -354,7 +354,7 @@ final class CodeHTML {
buf.append("%").append(vindex).append(" ").append(constant);
break;
default:
- if (Constants.NO_OF_OPERANDS[opcode] > 0) {
+ if (Constants.getNoOfOperands(opcode) > 0) {
for (int i = 0; i < Constants.getOperandTypeCount(opcode); i++) {
switch (Constants.getOperandType(opcode, i)) {
case Constants.T_BYTE:
@@ -527,7 +527,7 @@ final class CodeHTML {
if (tag != Constants.ATTR_UNKNOWN) {
file.print("<LI><A HREF=\"" + class_name + "_attributes.html#method"
+ method_number + "@" + i + "\" TARGET=Attributes>"
- + Constants.ATTRIBUTE_NAMES[tag] + "</A></LI>\n");
+ + Constants.getAttributeName(tag) + "</A></LI>\n");
} else {
file.print("<LI>" + attributes[i] + "</LI>");
}
@@ -540,7 +540,7 @@ final class CodeHTML {
tag = attributes2[j].getTag();
file.print("<LI><A HREF=\"" + class_name + "_attributes.html#" + "method"
+ method_number + "@" + i + "@" + j + "\" TARGET=Attributes>"
- + Constants.ATTRIBUTE_NAMES[tag] + "</A></LI>\n");
+ + Constants.getAttributeName(tag) + "</A></LI>\n");
}
file.print("</UL>");
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ConstantHTML.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ConstantHTML.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ConstantHTML.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/ConstantHTML.java Tue Aug 25 18:45:21 2015
@@ -89,7 +89,7 @@ final class ConstantHTML {
int name_index;
String ref;
// The header is always the same
- file.println("<H4> <A NAME=cp" + index + ">" + index + "</A> " + Constants.CONSTANT_NAMES[tag]
+ file.println("<H4> <A NAME=cp" + index + ">" + index + "</A> " + Constants.getConstantName(tag)
+ "</H4>");
/* For every constant type get the needed parameters and print them appropiately
*/
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/InstructionFinder.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/InstructionFinder.java?rev=1697755&r1=1697754&r2=1697755&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/InstructionFinder.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/util/InstructionFinder.java Tue Aug 25 18:45:21 2015
@@ -369,7 +369,7 @@ public class InstructionFinder {
// Add instruction alias to match anything
StringBuilder buf = new StringBuilder("(");
for (short i = 0; i < NO_OPCODES; i++) {
- if (Constants.NO_OF_OPERANDS[i] != Constants.UNDEFINED) { // Not an invalid opcode
+ if (Constants.getNoOfOperands(i) != Constants.UNDEFINED) { // Not an invalid opcode
buf.append(makeChar(i));
if (i < NO_OPCODES - 1) {
buf.append('|');