use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class MethodNode method initArguments.
private void initArguments(List<ArgType> args) {
int pos;
if (noCode) {
pos = 1;
} else {
pos = regsCount;
for (ArgType arg : args) {
pos -= arg.getRegCount();
}
}
if (accFlags.isStatic()) {
thisArg = null;
} else {
TypeImmutableArg arg = InsnArg.typeImmutableReg(pos - 1, parentClass.getClassInfo().getType());
arg.markAsThis();
thisArg = arg;
}
if (args.isEmpty()) {
argsList = Collections.emptyList();
return;
}
argsList = new ArrayList<RegisterArg>(args.size());
for (ArgType arg : args) {
argsList.add(InsnArg.typeImmutableReg(pos, arg));
pos += arg.getRegCount();
}
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class LocalVar method init.
private void init(String name, ArgType type, String sign) {
if (sign != null) {
try {
ArgType gType = ArgType.generic(sign);
if (checkSignature(type, sign, gType)) {
type = gType;
}
} catch (Exception e) {
LOG.error("Can't parse signature for local variable: {}", sign, e);
}
}
this.name = name;
this.type = type;
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class LocalVar method checkSignature.
private boolean checkSignature(ArgType type, String sign, ArgType gType) {
boolean apply;
ArgType el = gType.getArrayRootElement();
if (el.isGeneric()) {
if (!type.getArrayRootElement().getObject().equals(el.getObject())) {
LOG.warn("Generic type in debug info not equals: {} != {}", type, gType);
}
apply = true;
} else {
apply = el.isGenericType();
}
return apply;
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class SignatureParser method consumeType.
public ArgType consumeType() {
char ch = next();
mark();
switch(ch) {
case 'L':
ArgType obj = consumeObjectType(false);
if (obj != null) {
return obj;
}
break;
case 'T':
next();
mark();
if (forwardTo(';')) {
return ArgType.genericType(slice());
}
break;
case '[':
return ArgType.array(consumeType());
case STOP_CHAR:
return null;
default:
// primitive type (one char)
ArgType type = ArgType.parse(ch);
if (type != null) {
return type;
}
break;
}
throw new JadxRuntimeException("Can't parse type: " + debugString());
}
use of jadx.core.dex.instructions.args.ArgType in project jadx by skylot.
the class SignatureParser method consumeObjectType.
private ArgType consumeObjectType(boolean incompleteType) {
mark();
int ch;
do {
ch = next();
if (ch == STOP_CHAR) {
return null;
}
} while (ch != '<' && ch != ';');
if (ch == ';') {
String obj;
if (incompleteType) {
obj = slice().replace('/', '.');
} else {
obj = inclusiveSlice();
}
return ArgType.object(obj);
} else {
// generic type start ('<')
String obj = slice();
if (!incompleteType) {
obj += ";";
}
ArgType[] genArr = consumeGenericArgs();
consume('>');
ArgType genericType = ArgType.generic(obj, genArr);
if (lookAhead('.')) {
consume('.');
next();
// type parsing not completed, proceed to inner class
ArgType inner = consumeObjectType(true);
return ArgType.genericInner(genericType, inner.getObject(), inner.getGenericTypes());
} else {
consume(';');
return genericType;
}
}
}
Aggregations