|
|
@ -106,18 +106,25 @@ public class GrowableConstantPool extends ConstantPool { |
|
|
|
return putConstant(UTF8, utf); |
|
|
|
return putConstant(UTF8, utf); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int putClassRef(String name) { |
|
|
|
public int putClassName(String name) { |
|
|
|
name = name.replace('.','/'); |
|
|
|
name = name.replace('.','/'); |
|
|
|
return putIndexed(""+(char) CLASS + name, |
|
|
|
return putIndexed(""+(char) CLASS + name, |
|
|
|
CLASS, putUTF(name), 0); |
|
|
|
CLASS, putUTF(name), 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int putClassType(String name) { |
|
|
|
|
|
|
|
if (name.charAt(0) == 'L') |
|
|
|
|
|
|
|
name = name.substring(1, name.length()-1); |
|
|
|
|
|
|
|
return putIndexed(""+(char) CLASS + name, |
|
|
|
|
|
|
|
CLASS, putUTF(name), 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int putRef(int tag, Reference ref) { |
|
|
|
public int putRef(int tag, Reference ref) { |
|
|
|
String className = ref.getClazz(); |
|
|
|
String className = ref.getClazz(); |
|
|
|
String typeSig = ref.getType(); |
|
|
|
String typeSig = ref.getType(); |
|
|
|
String nameAndType = ref.getName() + "/" + typeSig; |
|
|
|
String nameAndType = ref.getName() + "/" + typeSig; |
|
|
|
|
|
|
|
|
|
|
|
int classIndex = putClassRef(className); |
|
|
|
int classIndex = putClassType(className); |
|
|
|
int nameIndex = putUTF(ref.getName()); |
|
|
|
int nameIndex = putUTF(ref.getName()); |
|
|
|
int typeIndex = putUTF(typeSig); |
|
|
|
int typeIndex = putUTF(typeSig); |
|
|
|
int nameTypeIndex = putIndexed("" + (char) NAMEANDTYPE + nameAndType, |
|
|
|
int nameTypeIndex = putIndexed("" + (char) NAMEANDTYPE + nameAndType, |
|
|
|