4
This commit is contained in:
@@ -238,6 +238,20 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// Bridge polymorphic interfaces to implementations without graph edges
|
||||
String callerSimple = caller.contains(".") ? caller.substring(caller.lastIndexOf('.') + 1) : caller;
|
||||
String targetSimple = target.contains(".") ? target.substring(target.lastIndexOf('.') + 1) : target;
|
||||
if (callerSimple.equals(targetSimple)) {
|
||||
String interfaceParamName = typeResolver.getParameterName(caller, paramIndex);
|
||||
if (interfaceParamName != null) {
|
||||
currentParamName = interfaceParamName;
|
||||
if (finalParamNameRef != null) finalParamNameRef[0] = currentParamName;
|
||||
resolvedValue = currentParamName + methodSuffix;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) break;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,21 @@ public class TypeResolver {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public String getParameterName(String methodFqn, int index) {
|
||||
if (methodFqn == null || !methodFqn.contains(".") || index < 0) return null;
|
||||
String className = methodFqn.substring(0, methodFqn.lastIndexOf('.'));
|
||||
String methodName = methodFqn.substring(methodFqn.lastIndexOf('.') + 1);
|
||||
TypeDeclaration td = context.getTypeDeclaration(className);
|
||||
if (td != null) {
|
||||
MethodDeclaration md = context.findMethodDeclaration(td, methodName, true);
|
||||
if (md != null && index < md.parameters().size()) {
|
||||
SingleVariableDeclaration svd = (SingleVariableDeclaration) md.parameters().get(index);
|
||||
return svd.getName().getIdentifier();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getParameterType(String methodFqn, int index) {
|
||||
if (methodFqn == null || !methodFqn.contains(".") || index < 0) return null;
|
||||
String className = methodFqn.substring(0, methodFqn.lastIndexOf('.'));
|
||||
|
||||
Reference in New Issue
Block a user