|
|
@ -1,4 +1,4 @@ |
|
|
|
/* jode.bytecode.GrowableConstantPool Copyright (C) 1998 Jochen Hoenicke. |
|
|
|
/* GrowableConstantPool Copyright (C) 1999 Jochen Hoenicke. |
|
|
|
* |
|
|
|
* |
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
|
|
* it under the terms of the GNU General Public License as published by |
|
|
|
* it under the terms of the GNU General Public License as published by |
|
|
@ -16,6 +16,7 @@ |
|
|
|
* |
|
|
|
* |
|
|
|
* $Id$ |
|
|
|
* $Id$ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package jode.bytecode; |
|
|
|
package jode.bytecode; |
|
|
|
import java.io.*; |
|
|
|
import java.io.*; |
|
|
|
import jode.Type; |
|
|
|
import jode.Type; |
|
|
@ -98,15 +99,17 @@ public class GrowableConstantPool extends ConstantPool { |
|
|
|
CLASS, putUTF(name), 0); |
|
|
|
CLASS, putUTF(name), 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int putRef(int tag, String[] names) { |
|
|
|
public int putRef(int tag, Reference ref) { |
|
|
|
int classIndex = putClassRef(names[0]); |
|
|
|
String className = ref.getClazz(); |
|
|
|
int nameIndex = putUTF(names[1]); |
|
|
|
String typeSig = ref.getType(); |
|
|
|
int typeIndex = putUTF(names[2]); |
|
|
|
String nameAndType = ref.getName() + "/" + typeSig; |
|
|
|
int nameTypeIndex = putIndexed("" + (char) NAMEANDTYPE |
|
|
|
|
|
|
|
+ names[1] + "/" + names[2], |
|
|
|
int classIndex = putClassRef(className); |
|
|
|
|
|
|
|
int nameIndex = putUTF(ref.getName()); |
|
|
|
|
|
|
|
int typeIndex = putUTF(typeSig); |
|
|
|
|
|
|
|
int nameTypeIndex = putIndexed("" + (char) NAMEANDTYPE + nameAndType, |
|
|
|
NAMEANDTYPE, nameIndex, typeIndex); |
|
|
|
NAMEANDTYPE, nameIndex, typeIndex); |
|
|
|
return putIndexed("" + (char)tag |
|
|
|
return putIndexed("" + (char)tag + className + "/" + nameAndType, |
|
|
|
+ names[0] + "/" + names[1] + "/" + names[2], |
|
|
|
|
|
|
|
tag, classIndex, nameTypeIndex); |
|
|
|
tag, classIndex, nameTypeIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -131,8 +134,8 @@ public class GrowableConstantPool extends ConstantPool { |
|
|
|
else if (c instanceof Double) |
|
|
|
else if (c instanceof Double) |
|
|
|
tag = DOUBLE; |
|
|
|
tag = DOUBLE; |
|
|
|
else |
|
|
|
else |
|
|
|
throw new IllegalArgumentException("illegal constant type: " |
|
|
|
throw new IllegalArgumentException("illegal constant "+c |
|
|
|
+ c.getClass()); |
|
|
|
+" of type: "+ c.getClass()); |
|
|
|
return putConstant(tag, c); |
|
|
|
return putConstant(tag, c); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|