use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class InsnDecoder method filledNewArray.
private InsnNode filledNewArray(DecodedInstruction insn, int offset, boolean isRange) {
int resReg = getMoveResultRegister(insnArr, offset);
ArgType arrType = dex.getType(insn.getIndex());
ArgType elType = arrType.getArrayElement();
boolean typeImmutable = elType.isPrimitive();
int regsCount = insn.getRegisterCount();
InsnArg[] regs = new InsnArg[regsCount];
if (isRange) {
int r = insn.getA();
for (int i = 0; i < regsCount; i++) {
regs[i] = InsnArg.reg(r, elType, typeImmutable);
r++;
}
} else {
for (int i = 0; i < regsCount; i++) {
int regNum = InsnUtils.getArg(insn, i);
regs[i] = InsnArg.reg(regNum, elType, typeImmutable);
}
}
InsnNode node = new FilledNewArrayNode(elType, regs.length);
node.setResult(resReg == -1 ? null : InsnArg.reg(resReg, arrType));
for (InsnArg arg : regs) {
node.addArg(arg);
}
return node;
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class AnnotationsParser method readAnnotation.
public static Annotation readAnnotation(DexNode dex, Section s, boolean readVisibility) throws DecodeException {
EncValueParser parser = new EncValueParser(dex, s);
Visibility visibility = null;
if (readVisibility) {
byte v = s.readByte();
visibility = VISIBILITIES[v];
}
int typeIndex = s.readUleb128();
int size = s.readUleb128();
Map<String, Object> values = new LinkedHashMap<String, Object>(size);
for (int i = 0; i < size; i++) {
String name = dex.getString(s.readUleb128());
values.put(name, parser.parseValue());
}
ArgType type = dex.getType(typeIndex);
Annotation annotation = new Annotation(visibility, type, values);
if (!type.isObject()) {
throw new DecodeException("Incorrect type for annotation: " + annotation);
}
return annotation;
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class SignatureParser method consumeExtendsTypesList.
/**
* List of types separated by ':' last type is 'java.lang.Object'.
* <p/>
* Example: "Ljava/lang/Exception;:Ljava/lang/Object;"
*/
private List<ArgType> consumeExtendsTypesList() {
List<ArgType> types = Collections.emptyList();
boolean next;
do {
ArgType argType = consumeType();
if (!argType.equals(ArgType.OBJECT)) {
if (types.isEmpty()) {
types = new LinkedList<ArgType>();
}
types.add(argType);
}
next = lookAhead(':');
if (next) {
consume(':');
}
} while (next);
return types;
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class RenameVisitor method makeMethodSignature.
private static String makeMethodSignature(MethodInfo methodInfo) {
StringBuilder signature = new StringBuilder();
signature.append(methodInfo.getAlias());
signature.append('(');
for (ArgType arg : methodInfo.getArgumentsTypes()) {
signature.append(TypeGen.signature(arg));
}
signature.append(')');
return signature.toString();
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class SimplifyVisitor method processCast.
private static InsnNode processCast(MethodNode mth, InsnNode insn) {
InsnArg castArg = insn.getArg(0);
ArgType argType = castArg.getType();
// Don't removes CHECK_CAST for wrapped INVOKE if invoked method returns different type
if (castArg.isInsnWrap()) {
InsnNode wrapInsn = ((InsnWrapArg) castArg).getWrapInsn();
if (wrapInsn.getType() == InsnType.INVOKE) {
argType = ((InvokeNode) wrapInsn).getCallMth().getReturnType();
}
}
ArgType castToType = (ArgType) ((IndexInsnNode) insn).getIndex();
if (ArgType.isCastNeeded(mth.dex(), argType, castToType)) {
return null;
}
InsnNode insnNode = new InsnNode(InsnType.MOVE, 1);
insnNode.setOffset(insn.getOffset());
insnNode.setResult(insn.getResult());
insnNode.addArg(castArg);
return insnNode;
}
Aggregations