|
|
@ -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 { |
|
|
|
public int getConstantInt(int i) throws ClassFormatException { |
|
|
|
if (i == 0 || tags[i] != ConstantPool.INTEGER) |
|
|
|
if (i == 0 || tags[i] != ConstantPool.INTEGER) |
|
|
|
throw new ClassFormatException("not an integer "+tags[i]); |
|
|
|
throw new ClassFormatException("not an integer "+tags[i]); |
|
|
|