Author: markt
Date: Sat Oct 13 21:43:36 2012
New Revision: 1397953
URL: http://svn.apache.org/viewvc?rev=1397953&view=rev
Log:
Run the UCDetector and remove unused code
Some follow-up remains.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
Sat Oct 13 21:43:36 2012
@@ -18,7 +18,6 @@
package org.apache.tomcat.util.bcel.classfile;
import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.IOException;
/**
@@ -76,14 +75,4 @@ public abstract class Annotations extend
public AnnotationEntry[] getAnnotationEntries() {
return annotation_table;
}
-
- protected void writeAnnotations(DataOutputStream dos) throws IOException {
- if (annotation_table == null) {
- return;
- }
- dos.writeShort(annotation_table.length);
- for (int i = 0; i < annotation_table.length; i++) {
- annotation_table[i].dump(dos);
- }
- }
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
Sat Oct 13 21:43:36 2012
@@ -117,8 +117,7 @@ public final class ClassParser {
// Return the information we have gathered in a new object
return new JavaClass(class_name_index, superclass_name_index,
- access_flags, constant_pool, interfaces, fields, methods,
- attributes);
+ access_flags, constant_pool, interfaces, attributes);
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
Sat Oct 13 21:43:36 2012
@@ -18,7 +18,6 @@
package org.apache.tomcat.util.bcel.classfile;
import java.io.DataInput;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -36,15 +35,6 @@ import org.apache.tomcat.util.bcel.Const
public final class CodeException implements Cloneable, Constants, Serializable
{
private static final long serialVersionUID = -6351674720658890686L;
- private int start_pc; // Range in the code the exception handler is
- private int end_pc; // active. start_pc is inclusive, end_pc exclusive
- private int handler_pc; /* Starting address of exception handler, i.e.,
- * an offset from start of code.
- */
- private int catch_type; /* If this is zero the handler catches any
- * exception, otherwise it points to the
- * exception class which is to be caught.
- */
/**
@@ -58,35 +48,7 @@ public final class CodeException impleme
}
- /**
- * @param start_pc Range in the code the exception handler is active,
- * start_pc is inclusive while
- * @param end_pc is exclusive
- * @param handler_pc Starting address of exception handler, i.e.,
- * an offset from start of code.
- * @param catch_type If zero the handler catches any
- * exception, otherwise it points to the exception class which is
- * to be caught.
- */
public CodeException(int start_pc, int end_pc, int handler_pc, int
catch_type) {
- this.start_pc = start_pc;
- this.end_pc = end_pc;
- this.handler_pc = handler_pc;
- this.catch_type = catch_type;
- }
-
-
- /**
- * Dump code exception to file stream in binary format.
- *
- * @param file Output file stream
- * @throws IOException
- */
- public final void dump( DataOutputStream file ) throws IOException {
- file.writeShort(start_pc);
- file.writeShort(end_pc);
- file.writeShort(handler_pc);
- file.writeShort(catch_type);
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
Sat Oct 13 21:43:36 2012
@@ -37,14 +37,6 @@ public final class ConstantInvokeDynamic
/**
- * Initialize from another object.
- */
- public ConstantInvokeDynamic(ConstantInvokeDynamic c) {
- this(c.getBootstrapMethodAttrIndex(), c.getNameAndTypeIndex());
- }
-
-
- /**
* Initialize instance from file data.
*
* @param file Input stream
@@ -68,17 +60,7 @@ public final class ConstantInvokeDynamic
}
- public void setBootstrapMethodAttrIndex(int bootstrap_method_attr_index) {
- this.bootstrap_method_attr_index = bootstrap_method_attr_index;
- }
-
-
public int getNameAndTypeIndex() {
return name_and_type_index;
}
-
-
- public void setNameAndTypeIndex(int name_and_type_index) {
- this.name_and_type_index = name_and_type_index;
- }
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
Sat Oct 13 21:43:36 2012
@@ -37,14 +37,6 @@ public final class ConstantMethodHandle
/**
- * Initialize from another object.
- */
- public ConstantMethodHandle(ConstantMethodHandle c) {
- this(c.getReferenceKind(), c.getReferenceIndex());
- }
-
-
- /**
* Initialize instance from file data.
*
* @param file Input stream
@@ -67,17 +59,7 @@ public final class ConstantMethodHandle
}
- public void setReferenceKind(int reference_kind) {
- this.reference_kind = reference_kind;
- }
-
-
public int getReferenceIndex() {
return reference_index;
}
-
-
- public void setReferenceIndex(int reference_index) {
- this.reference_index = reference_index;
- }
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
Sat Oct 13 21:43:36 2012
@@ -36,14 +36,6 @@ public final class ConstantMethodType ex
/**
- * Initialize from another object.
- */
- public ConstantMethodType(ConstantMethodType c) {
- this(c.getDescriptorIndex());
- }
-
-
- /**
* Initialize instance from file data.
*
* @param file Input stream
@@ -63,9 +55,4 @@ public final class ConstantMethodType ex
public int getDescriptorIndex() {
return descriptor_index;
}
-
-
- public void setDescriptorIndex(int descriptor_index) {
- this.descriptor_index = descriptor_index;
- }
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
Sat Oct 13 21:43:36 2012
@@ -250,12 +250,4 @@ public class ConstantPool implements Clo
c = getConstant(i, Constants.CONSTANT_Utf8);
return ((ConstantUtf8) c).getBytes();
}
-
-
- /**
- * @return Length of constant pool.
- */
- public int getLength() {
- return constant_pool_count;
- }
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java Sat Oct
13 21:43:36 2012
@@ -20,7 +20,6 @@ package org.apache.tomcat.util.bcel.clas
import java.io.DataInputStream;
import java.io.IOException;
-import org.apache.tomcat.util.bcel.Constants;
import org.apache.tomcat.util.bcel.util.BCELComparator;
/**
@@ -63,19 +62,6 @@ public final class Field extends FieldOr
/**
- * @return constant value associated with this field (may be null)
- */
- public final ConstantValue getConstantValue() {
- for (int i = 0; i < attributes_count; i++) {
- if (attributes[i].getTag() == Constants.ATTR_CONSTANT_VALUE) {
- return (ConstantValue) attributes[i];
- }
- }
- return null;
- }
-
-
- /**
* Return value as defined by given BCELComparator strategy.
* By default two Field objects are said to be equal when
* their names and signatures are equal.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java Sat
Oct 13 21:43:36 2012
@@ -18,7 +18,6 @@
package org.apache.tomcat.util.bcel.classfile;
import java.io.DataInput;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -34,11 +33,6 @@ import java.io.Serializable;
public final class InnerClass implements Cloneable, Serializable {
private static final long serialVersionUID = -4964694103982806087L;
- private int inner_class_index;
- private int outer_class_index;
- private int inner_name_index;
- private int inner_access_flags;
-
/**
* Construct object from file stream.
@@ -51,32 +45,8 @@ public final class InnerClass implements
}
- /**
- * @param inner_class_index Class index in constant pool of inner class
- * @param outer_class_index Class index in constant pool of outer class
- * @param inner_name_index Name index in constant pool of inner class
- * @param inner_access_flags Access flags of inner class
- */
public InnerClass(int inner_class_index, int outer_class_index, int
inner_name_index,
int inner_access_flags) {
- this.inner_class_index = inner_class_index;
- this.outer_class_index = outer_class_index;
- this.inner_name_index = inner_name_index;
- this.inner_access_flags = inner_access_flags;
- }
-
-
- /**
- * Dump inner class attribute to file stream in binary format.
- *
- * @param file Output file stream
- * @throws IOException
- */
- public final void dump( DataOutputStream file ) throws IOException {
- file.writeShort(inner_class_index);
- file.writeShort(outer_class_index);
- file.writeShort(inner_name_index);
- file.writeShort(inner_access_flags);
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Sat
Oct 13 21:43:36 2012
@@ -76,25 +76,17 @@ public class JavaClass extends AccessFla
* @param access_flags Access rights defined by bit flags
* @param constant_pool Array of constants
* @param interfaces Implemented interfaces
- * @param fields Class fields
- * @param methods Class methods
* @param attributes Class attributes
*/
public JavaClass(int class_name_index, int superclass_name_index,
int access_flags, ConstantPool constant_pool, int[] interfaces,
- Field[] fields, Method[] methods, Attribute[] attributes) {
+ Attribute[] attributes) {
if (interfaces == null) {
interfaces = new int[0];
}
if (attributes == null) {
attributes = new Attribute[0];
}
- if (fields == null) {
- fields = new Field[0];
- }
- if (methods == null) {
- methods = new Method[0];
- }
this.access_flags = access_flags;
this.attributes = attributes;
annotationsOutOfDate = true;
@@ -175,10 +167,6 @@ public class JavaClass extends AccessFla
}
- public final boolean isSuper() {
- return (access_flags & Constants.ACC_SUPER) != 0;
- }
-
/**
* Return value as defined by given BCELComparator strategy.
* By default two JavaClass objects are said to be equal when
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
Sat Oct 13 21:43:36 2012
@@ -18,7 +18,6 @@
package org.apache.tomcat.util.bcel.classfile;
import java.io.DataInput;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -35,14 +34,9 @@ import org.apache.tomcat.util.bcel.Const
public final class LocalVariable implements Constants, Cloneable, Serializable
{
private static final long serialVersionUID = -914189896372081589L;
- private int start_pc; // Range in which the variable is valid
- private int length;
- private int name_index; // Index in constant pool of variable name
- private int signature_index; // Index of variable signature
private int index; /* Variable is `index'th local variable on
* this method's frame.
*/
- private ConstantPool constant_pool;
/**
@@ -56,57 +50,9 @@ public final class LocalVariable impleme
}
- /**
- * @param start_pc Range in which the variable
- * @param length ... is valid
- * @param name_index Index in constant pool of variable name
- * @param signature_index Index of variable's signature
- * @param index Variable is `index'th local variable on the method's frame
- * @param constant_pool Array of constants
- */
public LocalVariable(int start_pc, int length, int name_index, int
signature_index, int index,
ConstantPool constant_pool) {
- this.start_pc = start_pc;
- this.length = length;
- this.name_index = name_index;
- this.signature_index = signature_index;
this.index = index;
- this.constant_pool = constant_pool;
- }
-
-
- /**
- * Dump local variable to file stream in binary format.
- *
- * @param file Output file stream
- * @throws IOException
- */
- public final void dump( DataOutputStream file ) throws IOException {
- file.writeShort(start_pc);
- file.writeShort(length);
- file.writeShort(name_index);
- file.writeShort(signature_index);
- file.writeShort(index);
- }
-
-
- /**
- * @return Variable name.
- */
- public final String getName() {
- ConstantUtf8 c;
- c = (ConstantUtf8) constant_pool.getConstant(name_index,
CONSTANT_Utf8);
- return c.getBytes();
- }
-
-
- /**
- * @return Signature.
- */
- public final String getSignature() {
- ConstantUtf8 c;
- c = (ConstantUtf8) constant_pool.getConstant(signature_index,
CONSTANT_Utf8);
- return c.getBytes();
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
Sat Oct 13 21:43:36 2012
@@ -70,25 +70,6 @@ public class LocalVariableTable extends
}
- /**
- *
- * @param index the variable slot
- *
- * @return the first LocalVariable that matches the slot or null if not
found
- *
- * @deprecated since 5.2 because multiple variables can share the
- * same slot, use getLocalVariable(int index, int pc) instead.
- */
- @java.lang.Deprecated
- public final LocalVariable getLocalVariable( int index ) {
- for (int i = 0; i < local_variable_table_length; i++) {
- if (local_variable_table[i].getIndex() == index) {
- return local_variable_table[i];
- }
- }
- return null;
- }
-
public final void setLocalVariableTable( LocalVariable[]
local_variable_table ) {
this.local_variable_table = local_variable_table;
local_variable_table_length = (local_variable_table == null)
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java Sat Oct
13 21:43:36 2012
@@ -86,32 +86,6 @@ public final class Method extends FieldO
/**
- * @return ExceptionTable attribute of method, if any, i.e., list all
- * exceptions the method may throw not exception handlers!
- */
- public final ExceptionTable getExceptionTable() {
- for (int i = 0; i < attributes_count; i++) {
- if (attributes[i] instanceof ExceptionTable) {
- return (ExceptionTable) attributes[i];
- }
- }
- return null;
- }
-
-
- /** @return LocalVariableTable of code attribute if any, i.e. the call is
forwarded
- * to the Code atribute.
- */
- public final LocalVariableTable getLocalVariableTable() {
- Code code = getCode();
- if (code == null) {
- return null;
- }
- return code.getLocalVariableTable();
- }
-
-
- /**
* Return value as defined by given BCELComparator strategy.
* By default two method objects are said to be equal when
* their names and signatures are equal.
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java Sat
Oct 13 21:43:36 2012
@@ -66,26 +66,6 @@ public final class PMGClass extends Attr
/**
- * @return PMG name.
- */
- public final String getPMGName() {
- ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(pmg_index,
- Constants.CONSTANT_Utf8);
- return c.getBytes();
- }
-
-
- /**
- * @return PMG class name.
- */
- public final String getPMGClassName() {
- ConstantUtf8 c = (ConstantUtf8)
constant_pool.getConstant(pmg_class_index,
- Constants.CONSTANT_Utf8);
- return c.getBytes();
- }
-
-
- /**
* @return deep copy of this attribute
*/
@Override
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java Sat
Oct 13 21:43:36 2012
@@ -63,16 +63,6 @@ public final class Signature extends Att
/**
- * @return GJ signature.
- */
- public final String getSignature() {
- ConstantUtf8 c = (ConstantUtf8)
constant_pool.getConstant(signature_index,
- Constants.CONSTANT_Utf8);
- return c.getBytes();
- }
-
-
- /**
* @return deep copy of this attribute
*/
@Override
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java Sat
Oct 13 21:43:36 2012
@@ -72,16 +72,6 @@ public final class SourceFile extends At
/**
- * @return Source file name.
- */
- public final String getSourceFileName() {
- ConstantUtf8 c = (ConstantUtf8)
constant_pool.getConstant(sourcefile_index,
- Constants.CONSTANT_Utf8);
- return c.getBytes();
- }
-
-
- /**
* @return deep copy of this attribute
*/
@Override
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
Sat Oct 13 21:43:36 2012
@@ -18,7 +18,6 @@
package org.apache.tomcat.util.bcel.classfile;
import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -36,59 +35,14 @@ public final class StackMapEntry impleme
private static final long serialVersionUID = 1L;
- private int byte_code_offset;
- private int number_of_locals;
- private StackMapType[] types_of_locals;
- private int number_of_stack_items;
- private StackMapType[] types_of_stack_items;
-
-
- /**
- * Construct object from file stream.
- * @param file Input stream
- * @throws IOException
- */
StackMapEntry(DataInputStream file) throws IOException {
this(file.readShort(), file.readShort(), null, -1, null);
- types_of_locals = new StackMapType[number_of_locals];
- for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i] = new StackMapType(file);
- }
- number_of_stack_items = file.readShort();
- types_of_stack_items = new StackMapType[number_of_stack_items];
- for (int i = 0; i < number_of_stack_items; i++) {
- types_of_stack_items[i] = new StackMapType(file);
- }
}
public StackMapEntry(int byte_code_offset, int number_of_locals,
StackMapType[] types_of_locals, int number_of_stack_items,
StackMapType[] types_of_stack_items) {
- this.byte_code_offset = byte_code_offset;
- this.number_of_locals = number_of_locals;
- this.types_of_locals = types_of_locals;
- this.number_of_stack_items = number_of_stack_items;
- this.types_of_stack_items = types_of_stack_items;
- }
-
-
- /**
- * Dump stack map entry
- *
- * @param file Output file stream
- * @throws IOException
- */
- public final void dump( DataOutputStream file ) throws IOException {
- file.writeShort(byte_code_offset);
- file.writeShort(number_of_locals);
- for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i].dump(file);
- }
- file.writeShort(number_of_stack_items);
- for (int i = 0; i < number_of_stack_items; i++) {
- types_of_stack_items[i].dump(file);
- }
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
Sat Oct 13 21:43:36 2012
@@ -18,12 +18,9 @@
package org.apache.tomcat.util.bcel.classfile;
import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;
-import org.apache.tomcat.util.bcel.Constants;
-
/**
* This class represents a stack map entry recording the types of
* local variables and the the of stack items at a given byte code offset.
@@ -38,13 +35,6 @@ public final class StackMapTableEntry im
private static final long serialVersionUID = 1L;
- private int frame_type;
- private int byte_code_offset_delta;
- private int number_of_locals;
- private StackMapType[] types_of_locals;
- private int number_of_stack_items;
- private StackMapType[] types_of_stack_items;
-
/**
* Construct object from file stream.
@@ -53,99 +43,12 @@ public final class StackMapTableEntry im
*/
StackMapTableEntry(DataInputStream file) throws IOException {
this(file.read(), -1, -1, null, -1, null);
-
- if (frame_type >= Constants.SAME_FRAME && frame_type <=
Constants.SAME_FRAME_MAX) {
- byte_code_offset_delta = frame_type - Constants.SAME_FRAME;
- } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME &&
frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
- byte_code_offset_delta = frame_type -
Constants.SAME_LOCALS_1_STACK_ITEM_FRAME;
- number_of_stack_items = 1;
- types_of_stack_items = new StackMapType[1];
- types_of_stack_items[0] = new StackMapType(file);
- } else if (frame_type ==
Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
- byte_code_offset_delta = file.readShort();
- number_of_stack_items = 1;
- types_of_stack_items = new StackMapType[1];
- types_of_stack_items[0] = new StackMapType(file);
- } else if (frame_type >= Constants.CHOP_FRAME && frame_type <=
Constants.CHOP_FRAME_MAX) {
- byte_code_offset_delta = file.readShort();
- } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
- byte_code_offset_delta = file.readShort();
- } else if (frame_type >= Constants.APPEND_FRAME && frame_type <=
Constants.APPEND_FRAME_MAX) {
- byte_code_offset_delta = file.readShort();
- number_of_locals = frame_type - 251;
- types_of_locals = new StackMapType[number_of_locals];
- for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i] = new StackMapType(file);
- }
- } else if (frame_type == Constants.FULL_FRAME) {
- byte_code_offset_delta = file.readShort();
- number_of_locals = file.readShort();
- types_of_locals = new StackMapType[number_of_locals];
- for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i] = new StackMapType(file);
- }
- number_of_stack_items = file.readShort();
- types_of_stack_items = new StackMapType[number_of_stack_items];
- for (int i = 0; i < number_of_stack_items; i++) {
- types_of_stack_items[i] = new StackMapType(file);
- }
- } else {
- /* Can't happen */
- throw new ClassFormatException ("Invalid frame type found while
parsing stack map table: " + frame_type);
- }
}
public StackMapTableEntry(int tag, int byte_code_offset_delta, int
number_of_locals,
StackMapType[] types_of_locals, int number_of_stack_items,
StackMapType[] types_of_stack_items) {
- this.frame_type = tag;
- this.byte_code_offset_delta = byte_code_offset_delta;
- this.number_of_locals = number_of_locals;
- this.types_of_locals = types_of_locals;
- this.number_of_stack_items = number_of_stack_items;
- this.types_of_stack_items = types_of_stack_items;
- }
-
-
- /**
- * Dump stack map entry
- *
- * @param file Output file stream
- * @throws IOException
- */
- public final void dump( DataOutputStream file ) throws IOException {
- file.write(frame_type);
- if (frame_type >= Constants.SAME_FRAME && frame_type <=
Constants.SAME_FRAME_MAX) {
- // nothing to be done
- } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME &&
frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
- types_of_stack_items[0].dump(file);
- } else if (frame_type ==
Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
- file.writeShort(byte_code_offset_delta);
- types_of_stack_items[0].dump(file);
- } else if (frame_type >= Constants.CHOP_FRAME && frame_type <=
Constants.CHOP_FRAME_MAX) {
- file.writeShort(byte_code_offset_delta);
- } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
- file.writeShort(byte_code_offset_delta);
- } else if (frame_type >= Constants.APPEND_FRAME && frame_type <=
Constants.APPEND_FRAME_MAX) {
- file.writeShort(byte_code_offset_delta);
- for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i].dump(file);
- }
- } else if (frame_type == Constants.FULL_FRAME) {
- file.writeShort(byte_code_offset_delta);
- file.writeShort(number_of_locals);
- for (int i = 0; i < number_of_locals; i++) {
- types_of_locals[i].dump(file);
- }
- file.writeShort(number_of_stack_items);
- for (int i = 0; i < number_of_stack_items; i++) {
- types_of_stack_items[i].dump(file);
- }
- } else {
- /* Can't happen */
- throw new ClassFormatException ("Invalid Stack map table tag: " +
frame_type);
- }
}
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1397953&r1=1397952&r2=1397953&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Sat
Oct 13 21:43:36 2012
@@ -64,17 +64,6 @@ public abstract class Utility {
/**
* Convert bit field of flags into string such as `static final'.
*
- * @param access_flags Access flags
- * @return String representation of flags
- */
- public static final String accessToString( int access_flags ) {
- return accessToString(access_flags, false);
- }
-
-
- /**
- * Convert bit field of flags into string such as `static final'.
- *
* Special case: Classes compiled with new compilers and with the
* `ACC_SUPER' flag would be said to be "synchronized". This is
* because SUN used the same value for the flags `ACC_SUPER' and
@@ -106,54 +95,6 @@ public abstract class Utility {
/**
- * @param access_flags the class flags
- *
- * @return "class" or "interface", depending on the ACC_INTERFACE flag
- */
- public static final String classOrInterface( int access_flags ) {
- return ((access_flags & Constants.ACC_INTERFACE) != 0) ? "interface" :
"class";
- }
-
-
- /**
- * Disassemble a byte array of JVM byte codes starting from code line
- * `index' and return the disassembled string representation. Decode only
- * `num' opcodes (including their operands), use -1 if you want to
- * decompile everything.
- *
- * @param code byte code array
- * @param constant_pool Array of constants
- * @param index offset in `code' array
- * <EM>(number of opcodes, not bytes!)</EM>
- * @param length number of opcodes to decompile, -1 for all
- * @param verbose be verbose, e.g. print constant pool index
- * @return String representation of byte codes
- */
- public static final String codeToString( byte[] code, ConstantPool
constant_pool, int index,
- int length, boolean verbose ) {
- StringBuilder buf = new StringBuilder(code.length * 20); // Should be
sufficient
- ByteSequence stream = new ByteSequence(code);
- try {
- for (int i = 0; i < index; i++) {
- codeToString(stream, constant_pool, verbose);
- }
- for (int i = 0; stream.available() > 0; i++) {
- if ((length < 0) || (i < length)) {
- String indices = fillup(stream.getIndex() + ":", 6, true,
' ');
- buf.append(indices).append(codeToString(stream,
constant_pool, verbose))
- .append('\n');
- }
- }
- } catch (IOException e) {
- System.out.println(buf.toString());
- e.printStackTrace();
- throw new ClassFormatException("Byte code error: " + e, e);
- }
- return buf.toString();
- }
-
-
- /**
* Disassemble a stream of byte codes and return the
* string representation.
*
@@ -409,18 +350,6 @@ public abstract class Utility {
/**
- * Shorten long class names, <em>java/lang/String</em> becomes
- * <em>String</em>.
- *
- * @param str The long class name
- * @return Compacted class name
- */
- public static final String compactClassName( String str ) {
- return compactClassName(str, true);
- }
-
-
- /**
* Shorten long class name <em>str</em>, i.e., chop off the
<em>prefix</em>,
* if the
* class name starts with this string and the flag <em>chopit</em> is true.
@@ -466,47 +395,6 @@ public abstract class Utility {
/**
- * Replace all occurrences of <em>old</em> in <em>str</em> with
<em>new</em>.
- *
- * @param str String to permute
- * @param old String to be replaced
- * @param new_ Replacement string
- * @return new String object
- */
- public static final String replace( String str, String old, String new_ ) {
- int index, old_index;
- try {
- if (str.indexOf(old) != -1) { // `old' found in str
- StringBuffer buf = new StringBuffer();
- old_index = 0; // String start offset
- // While we have something to replace
- while ((index = str.indexOf(old, old_index)) != -1) {
- buf.append(str.substring(old_index, index)); // append
prefix
- buf.append(new_); // append replacement
- old_index = index + old.length(); // Skip `old'.length
chars
- }
- buf.append(str.substring(old_index)); // append rest of string
- str = buf.toString();
- }
- } catch (StringIndexOutOfBoundsException e) { // Should not occur
- System.err.println(e);
- }
- return str;
- }
-
-
- /**
- * Converts signature to string with all class names compacted.
- *
- * @param signature to convert
- * @return Human readable signature
- */
- public static final String signatureToString( String signature ) {
- return signatureToString(signature, true);
- }
-
-
- /**
* The field signature represents the value of an argument to a function or
* the value of a variable. It is a series of bytes generated by the
* following grammar:
@@ -599,36 +487,6 @@ public abstract class Utility {
}
}
- /**
- * Convert (signed) byte to (unsigned) short value, i.e., all negative
- * values become positive.
- */
- private static final short byteToShort( byte b ) {
- return (b < 0) ? (short) (256 + b) : (short) b;
- }
-
-
- /** Convert bytes into hexadecimal string
- *
- * @param bytes an array of bytes to convert to hexadecimal
- *
- * @return bytes as hexadecimal string, e.g. 00 FA 12 ...
- */
- public static final String toHexString( byte[] bytes ) {
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < bytes.length; i++) {
- short b = byteToShort(bytes[i]);
- String hex = Integer.toString(b, 0x10);
- if (b < 0x10) {
- buf.append('0');
- }
- buf.append(hex);
- if (i < bytes.length - 1) {
- buf.append(' ');
- }
- }
- return buf.toString();
- }
/**
* Fillup char with up to length characters with char `fill' and justify
it left or right.
@@ -673,35 +531,4 @@ public abstract class Utility {
CHAR_MAP[j] = '_';
MAP_CHAR['_'] = j;
}
-
- /**
- * Escape all occurences of newline chars '\n', quotes \", etc.
- */
- public static final String convertString( String label ) {
- char[] ch = label.toCharArray();
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < ch.length; i++) {
- switch (ch[i]) {
- case '\n':
- buf.append("\\n");
- break;
- case '\r':
- buf.append("\\r");
- break;
- case '\"':
- buf.append("\\\"");
- break;
- case '\'':
- buf.append("\\'");
- break;
- case '\\':
- buf.append("\\\\");
- break;
- default:
- buf.append(ch[i]);
- break;
- }
- }
- return buf.toString();
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]