import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Map;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.ListIterator;
import java.util.List;
import java.util.Iterator;
out.write(info);
}
- static int getLength(LinkedList list) {
+ static int getLength(ArrayList list) {
int size = 0;
int n = list.size();
for (int i = 0; i < n; ++i) {
return size;
}
- static AttributeInfo lookup(LinkedList list, String name) {
+ static AttributeInfo lookup(ArrayList list, String name) {
if (list == null)
return null;
return null; // no such attribute
}
- static synchronized void remove(LinkedList list, String name) {
+ static synchronized void remove(ArrayList list, String name) {
if (list == null)
return;
}
}
- static void writeAll(LinkedList list, DataOutputStream out)
+ static void writeAll(ArrayList list, DataOutputStream out)
throws IOException
{
if (list == null)
}
}
- static LinkedList copyAll(LinkedList list, ConstPool cp) {
+ static ArrayList copyAll(ArrayList list, ConstPool cp) {
if (list == null)
return null;
- LinkedList newList = new LinkedList();
+ ArrayList newList = new ArrayList();
int n = list.size();
for (int i = 0; i < n; ++i) {
AttributeInfo attr = (AttributeInfo)list.get(i);
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
-import java.util.LinkedList;
+import java.util.ArrayList;
/**
* <code>field_info</code> structure.
String cachedName;
String cachedType;
int descriptor;
- LinkedList attribute; // may be null.
+ ArrayList attribute; // may be null.
private FieldInfo(ConstPool cp) {
constPool = cp;
}
void prune(ConstPool cp) {
- LinkedList newAttributes = new LinkedList();
+ ArrayList newAttributes = new ArrayList();
AttributeInfo invisibleAnnotations
= getAttribute(AnnotationsAttribute.invisibleTag);
if (invisibleAnnotations != null) {
*/
public List getAttributes() {
if (attribute == null)
- attribute = new LinkedList();
+ attribute = new ArrayList();
return attribute;
}
*/
public void addAttribute(AttributeInfo info) {
if (attribute == null)
- attribute = new LinkedList();
+ attribute = new ArrayList();
AttributeInfo.remove(attribute, info.getName());
attribute.add(info);
name = in.readUnsignedShort();
descriptor = in.readUnsignedShort();
int n = in.readUnsignedShort();
- attribute = new LinkedList();
+ attribute = new ArrayList();
for (int i = 0; i < n; ++i)
attribute.add(AttributeInfo.read(constPool, in));
}
static final int ASIZE = 128;
static final int ABITS = 7; // ASIZE = 2^ABITS
static final int VSIZE = 8;
- private Object[][] objects;
+ private ConstInfo[][] objects;
private int elements;
public LongVector() {
- objects = new Object[VSIZE][];
+ objects = new ConstInfo[VSIZE][];
elements = 0;
}
public LongVector(int initialSize) {
int vsize = ((initialSize >> ABITS) & ~(VSIZE - 1)) + VSIZE;
- objects = new Object[vsize][];
+ objects = new ConstInfo[vsize][];
elements = 0;
}
public int capacity() { return objects.length * ASIZE; }
- public Object elementAt(int i) {
+ public ConstInfo elementAt(int i) {
if (i < 0 || elements <= i)
return null;
return objects[i >> ABITS][i & (ASIZE - 1)];
}
- public void addElement(Object value) {
+ public void addElement(ConstInfo value) {
int nth = elements >> ABITS;
int offset = elements & (ASIZE - 1);
int len = objects.length;
if (nth >= len) {
- Object[][] newObj = new Object[len + VSIZE][];
+ ConstInfo[][] newObj = new ConstInfo[len + VSIZE][];
System.arraycopy(objects, 0, newObj, 0, len);
objects = newObj;
}
if (objects[nth] == null)
- objects[nth] = new Object[ASIZE];
+ objects[nth] = new ConstInfo[ASIZE];
objects[nth][offset] = value;
elements++;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javassist.ClassPool;
* @see javassist.CtMethod#getMethodInfo()
* @see javassist.CtConstructor#getMethodInfo()
*/
-public final class MethodInfo {
+public class MethodInfo {
ConstPool constPool;
int accessFlags;
int name;
String cachedName;
int descriptor;
- LinkedList attribute; // may be null
+ ArrayList attribute; // may be null
/**
* If this value is true, Javassist maintains a <code>StackMap</code> attribute
}
void prune(ConstPool cp) {
- LinkedList newAttributes = new LinkedList();
+ ArrayList newAttributes = new ArrayList();
AttributeInfo invisibleAnnotations
= getAttribute(AnnotationsAttribute.invisibleTag);
*/
public List getAttributes() {
if (attribute == null)
- attribute = new LinkedList();
+ attribute = new ArrayList();
return attribute;
}
*/
public void addAttribute(AttributeInfo info) {
if (attribute == null)
- attribute = new LinkedList();
+ attribute = new ArrayList();
AttributeInfo.remove(attribute, info.getName());
attribute.add(info);
public void setExceptionsAttribute(ExceptionsAttribute cattr) {
removeExceptionsAttribute();
if (attribute == null)
- attribute = new LinkedList();
+ attribute = new ArrayList();
attribute.add(cattr);
}
public void setCodeAttribute(CodeAttribute cattr) {
removeCodeAttribute();
if (attribute == null)
- attribute = new LinkedList();
+ attribute = new ArrayList();
attribute.add(cattr);
}
String desc2 = Descriptor.rename(desc, classnames);
descriptor = destCp.addUtf8Info(desc2);
- attribute = new LinkedList();
+ attribute = new ArrayList();
ExceptionsAttribute eattr = src.getExceptionsAttribute();
if (eattr != null)
attribute.add(eattr.copy(destCp, classnames));
name = in.readUnsignedShort();
descriptor = in.readUnsignedShort();
int n = in.readUnsignedShort();
- attribute = new LinkedList();
+ attribute = new ArrayList();
for (int i = 0; i < n; ++i)
attribute.add(AttributeInfo.read(constPool, in));
}