use of jadx.core.dex.nodes.parser.SignatureParser in project jadx by skylot.
the class MethodNode method parseSignature.
private boolean parseSignature() {
SignatureParser sp = SignatureParser.fromNode(this);
if (sp == null) {
return false;
}
try {
genericMap = sp.consumeGenericMap();
List<ArgType> argsTypes = sp.consumeMethodArgs();
retType = sp.consumeType();
List<ArgType> mthArgs = mthInfo.getArgumentsTypes();
if (argsTypes.size() != mthArgs.size()) {
if (argsTypes.isEmpty()) {
return false;
}
if (!mthInfo.isConstructor()) {
LOG.warn("Wrong signature parse result: {} -> {}, not generic version: {}", sp, argsTypes, mthArgs);
return false;
} else if (getParentClass().getAccessFlags().isEnum()) {
// TODO:
argsTypes.add(0, mthArgs.get(0));
argsTypes.add(1, mthArgs.get(1));
} else {
// add synthetic arg for outer class
argsTypes.add(0, mthArgs.get(0));
}
if (argsTypes.size() != mthArgs.size()) {
return false;
}
}
initArguments(argsTypes);
} catch (JadxRuntimeException e) {
LOG.error("Method signature parse error: {}", this, e);
return false;
}
return true;
}
use of jadx.core.dex.nodes.parser.SignatureParser in project jadx by skylot.
the class ClassNode method parseClassSignature.
private void parseClassSignature() {
SignatureParser sp = SignatureParser.fromNode(this);
if (sp == null) {
return;
}
try {
// parse class generic map
genericMap = sp.consumeGenericMap();
// parse super class signature
superClass = sp.consumeType();
// parse interfaces signatures
for (int i = 0; i < interfaces.size(); i++) {
ArgType type = sp.consumeType();
if (type != null) {
interfaces.set(i, type);
} else {
break;
}
}
} catch (JadxRuntimeException e) {
LOG.error("Class signature parse error: {}", this, e);
}
}
Aggregations