use of jadx.core.clsp.ClspMethod in project jadx by skylot.
the class OverrideMethodVisitor method processOverrideMethods.
private MethodOverrideAttr processOverrideMethods(MethodNode mth, SuperTypesData superData) {
MethodOverrideAttr result = mth.get(AType.METHOD_OVERRIDE);
if (result != null) {
return result;
}
ClassNode cls = mth.getParentClass();
String signature = mth.getMethodInfo().makeSignature(false);
List<IMethodDetails> overrideList = new ArrayList<>();
Set<IMethodDetails> baseMethods = new HashSet<>();
for (ArgType superType : superData.getSuperTypes()) {
ClassNode classNode = mth.root().resolveClass(superType);
if (classNode != null) {
MethodNode ovrdMth = searchOverriddenMethod(classNode, signature);
if (ovrdMth != null) {
if (isMethodVisibleInCls(ovrdMth, cls)) {
overrideList.add(ovrdMth);
MethodOverrideAttr attr = ovrdMth.get(AType.METHOD_OVERRIDE);
if (attr != null) {
addBaseMethod(superData, overrideList, baseMethods, superType);
return buildOverrideAttr(mth, overrideList, baseMethods, attr);
}
}
}
} else {
ClspClass clsDetails = mth.root().getClsp().getClsDetails(superType);
if (clsDetails != null) {
Map<String, ClspMethod> methodsMap = clsDetails.getMethodsMap();
for (Map.Entry<String, ClspMethod> entry : methodsMap.entrySet()) {
String mthShortId = entry.getKey();
if (mthShortId.startsWith(signature)) {
overrideList.add(entry.getValue());
break;
}
}
}
}
addBaseMethod(superData, overrideList, baseMethods, superType);
}
return buildOverrideAttr(mth, overrideList, baseMethods, null);
}
use of jadx.core.clsp.ClspMethod in project jadx by skylot.
the class MethodUtils method processMethodArgsOverloaded.
private boolean processMethodArgsOverloaded(ArgType startCls, MethodInfo mthInfo, @Nullable List<IMethodDetails> collectedMths) {
if (startCls == null || !startCls.isObject()) {
return false;
}
boolean isMthConstructor = mthInfo.isConstructor() || mthInfo.isClassInit();
ClassNode classNode = root.resolveClass(startCls);
if (classNode != null) {
for (MethodNode mth : classNode.getMethods()) {
if (mthInfo.isOverloadedBy(mth.getMethodInfo())) {
if (collectedMths == null) {
return true;
}
collectedMths.add(mth);
}
}
if (!isMthConstructor) {
if (processMethodArgsOverloaded(classNode.getSuperClass(), mthInfo, collectedMths)) {
if (collectedMths == null) {
return true;
}
}
for (ArgType parentInterface : classNode.getInterfaces()) {
if (processMethodArgsOverloaded(parentInterface, mthInfo, collectedMths)) {
if (collectedMths == null) {
return true;
}
}
}
}
} else {
ClspClass clsDetails = root.getClsp().getClsDetails(startCls);
if (clsDetails == null) {
// class info not available
return false;
}
for (ClspMethod clspMth : clsDetails.getMethodsMap().values()) {
if (mthInfo.isOverloadedBy(clspMth.getMethodInfo())) {
if (collectedMths == null) {
return true;
}
collectedMths.add(clspMth);
}
}
if (!isMthConstructor) {
for (ArgType parent : clsDetails.getParents()) {
if (processMethodArgsOverloaded(parent, mthInfo, collectedMths)) {
if (collectedMths == null) {
return true;
}
}
}
}
}
return false;
}
Aggregations