Reference instead of String[3[

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@486 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 33e95a8713
commit ba69dc47cb
  1. 25
      jode/jode/bytecode/GrowableConstantPool.java

@ -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);
} }
} }

Loading…
Cancel
Save