use of jadx.plugins.input.java.data.ConstantType in project jadx by skylot.
the class LoadConstDecoder method decode.
@Override
public void decode(CodeDecodeState state) {
DataReader reader = state.reader();
JavaInsnData insn = state.insn();
int index;
if (wide) {
index = reader.readU2();
} else {
index = reader.readU1();
}
ConstPoolReader constPoolReader = insn.constPoolReader();
ConstantType constType = constPoolReader.jumpToConst(index);
switch(constType) {
case INTEGER:
case FLOAT:
insn.setLiteral(constPoolReader.readU4());
insn.setOpcode(Opcode.CONST);
state.push(0, SVType.NARROW);
break;
case LONG:
case DOUBLE:
insn.setLiteral(constPoolReader.readU8());
insn.setOpcode(Opcode.CONST_WIDE);
state.push(0, SVType.WIDE);
break;
case STRING:
insn.setIndex(constPoolReader.readU2());
insn.setOpcode(Opcode.CONST_STRING);
state.push(0, SVType.NARROW);
break;
case UTF8:
insn.setIndex(index);
insn.setOpcode(Opcode.CONST_STRING);
state.push(0, SVType.NARROW);
break;
case CLASS:
insn.setIndex(index);
insn.setOpcode(Opcode.CONST_CLASS);
state.push(0, SVType.NARROW);
break;
default:
throw new JavaClassParseException("Unsupported constant type: " + constType);
}
}
Aggregations