use of jadx.core.dex.info.MethodInfo in project jadx by skylot.
the class Deobfuscator method getMethodAlias.
@Nullable
private String getMethodAlias(MethodNode mth) {
if (mth.contains(AFlag.DONT_RENAME)) {
return null;
}
MethodInfo methodInfo = mth.getMethodInfo();
if (methodInfo.isClassInit() || methodInfo.isConstructor()) {
return null;
}
String alias = getAssignedAlias(methodInfo);
if (alias != null) {
return alias;
}
if (shouldRename(mth.getName())) {
return makeMethodAlias(mth);
}
return null;
}
use of jadx.core.dex.info.MethodInfo in project jadx by skylot.
the class ClsSet method readMethod.
private ClspMethod readMethod(DataInputStream in, ClassInfo clsInfo) throws IOException {
String name = readString(in);
List<ArgType> argTypes = readArgTypesList(in);
ArgType retType = readArgType(in);
List<ArgType> genericArgTypes = readArgTypesList(in);
if (genericArgTypes.isEmpty() || Objects.equals(genericArgTypes, argTypes)) {
genericArgTypes = argTypes;
}
ArgType genericRetType = readArgType(in);
if (Objects.equals(genericRetType, retType)) {
genericRetType = retType;
}
List<ArgType> typeParameters = readArgTypesList(in);
int accFlags = in.readInt();
List<ArgType> throwList = readArgTypesList(in);
MethodInfo methodInfo = MethodInfo.fromDetails(root, clsInfo, name, argTypes, retType);
return new ClspMethod(methodInfo, genericArgTypes, genericRetType, typeParameters, throwList, accFlags);
}
use of jadx.core.dex.info.MethodInfo in project jadx by skylot.
the class MethodInvokeVisitor method processInvoke.
private void processInvoke(MethodNode parentMth, BaseInvokeNode invokeInsn) {
MethodInfo callMth = invokeInsn.getCallMth();
if (callMth.getArgsCount() == 0) {
return;
}
IMethodDetails mthDetails = root.getMethodUtils().getMethodDetails(invokeInsn);
if (mthDetails == null) {
if (Consts.DEBUG) {
parentMth.addDebugComment("Method info not found: " + callMth);
}
processUnknown(invokeInsn);
} else {
if (mthDetails.isVarArg()) {
ArgType last = Utils.last(mthDetails.getArgTypes());
if (last != null && last.isArray()) {
invokeInsn.add(AFlag.VARARG_CALL);
}
}
processOverloaded(parentMth, invokeInsn, mthDetails);
}
}
use of jadx.core.dex.info.MethodInfo in project jadx by skylot.
the class MethodInvokeVisitor method getTypeVarsMapping.
private Map<ArgType, ArgType> getTypeVarsMapping(BaseInvokeNode invokeInsn) {
MethodInfo callMthInfo = invokeInsn.getCallMth();
ArgType declClsType = callMthInfo.getDeclClass().getType();
ArgType callClsType = getClsCallType(invokeInsn, declClsType);
TypeUtils typeUtils = root.getTypeUtils();
Map<ArgType, ArgType> clsTypeVars = typeUtils.getTypeVariablesMapping(callClsType);
Map<ArgType, ArgType> mthTypeVars = typeUtils.getTypeVarMappingForInvoke(invokeInsn);
return Utils.mergeMaps(clsTypeVars, mthTypeVars);
}
use of jadx.core.dex.info.MethodInfo in project jadx by skylot.
the class MethodInvokeVisitor method processOverloaded.
private void processOverloaded(MethodNode parentMth, BaseInvokeNode invokeInsn, IMethodDetails mthDetails) {
MethodInfo callMth = invokeInsn.getCallMth();
ArgType callCls = getCallClassFromInvoke(parentMth, invokeInsn, callMth);
List<IMethodDetails> overloadMethods = root.getMethodUtils().collectOverloadedMethods(callCls, callMth);
if (overloadMethods.isEmpty()) {
// not overloaded
return;
}
// resolve generic type variables
Map<ArgType, ArgType> typeVarsMapping = getTypeVarsMapping(invokeInsn);
IMethodDetails effectiveMthDetails = resolveTypeVars(mthDetails, typeVarsMapping);
List<IMethodDetails> effectiveOverloadMethods = new ArrayList<>(overloadMethods.size() + 1);
for (IMethodDetails overloadMethod : overloadMethods) {
effectiveOverloadMethods.add(resolveTypeVars(overloadMethod, typeVarsMapping));
}
effectiveOverloadMethods.add(effectiveMthDetails);
// search cast types to resolve overloading
int argsOffset = invokeInsn.getFirstArgOffset();
List<ArgType> compilerVarTypes = collectCompilerVarTypes(invokeInsn, argsOffset);
List<ArgType> castTypes = searchCastTypes(parentMth, effectiveMthDetails, effectiveOverloadMethods, compilerVarTypes);
applyArgsCast(invokeInsn, argsOffset, compilerVarTypes, castTypes);
}
Aggregations