getConstant added

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@392 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent b2c8d6b995
commit 356d2a0aa1
  1. 15
      jode/jode/bytecode/ConstantPool.java

@ -144,6 +144,21 @@ public class ConstantPool {
}
}
public Object getConstant(int i) throws ClassFormatException {
if (i == 0)
throw new ClassFormatException("null constant");
switch (tags[i]) {
case ConstantPool.INTEGER:
case ConstantPool.FLOAT:
case ConstantPool.LONG:
case ConstantPool.DOUBLE:
return constants[i];
case ConstantPool.STRING:
return getUTF8(indices1[i]);
}
throw new ClassFormatException("unknown constant tag: "+tags[i]);
}
public int getConstantInt(int i) throws ClassFormatException {
if (i == 0 || tags[i] != ConstantPool.INTEGER)
throw new ClassFormatException("not an integer "+tags[i]);

Loading…
Cancel
Save