diff --git a/jode/jode/bytecode/ConstantPool.java b/jode/jode/bytecode/ConstantPool.java index 43d1e43..af4ced9 100644 --- a/jode/jode/bytecode/ConstantPool.java +++ b/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]);