Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cde2e34
added MethodHandle test cases
moebarni Jun 22, 2025
732834e
added preanalysis in AbstractCallGraphAlgorithm constructor; added ch…
moebarni Jun 25, 2025
fa59d4a
updated test cases
moebarni Jun 25, 2025
4436c41
added VarHandle test
moebarni Jun 30, 2025
f24ff9a
bad "solution" for RTA
moebarni Jun 30, 2025
eed2df1
Merge branch 'develop' into 1266-feature-investigate-varargs-cg
moebarni Jun 30, 2025
ece4faa
wrapper approach (failed to detect new MethodHandle instance)
moebarni Jul 7, 2025
9c20cf2
extended collectInstantiatedClassesInMethod (only for method/varHandl…
moebarni Jul 11, 2025
9eb4cb8
with comments and separated version
moebarni Jul 11, 2025
5a95bdf
cleaned
moebarni Jul 11, 2025
3aeebd4
Merge branch 'develop' into 1266-feature-investigate-varargs-cg
moebarni Jul 11, 2025
1646566
deleted sout, comment, first test
moebarni Jul 29, 2025
d2a4f11
changed method name; deleted test case for example1; deleted unnecess…
moebarni Jul 29, 2025
1d450b4
deleted sout; added diffParamTest + superClassTest
moebarni Jul 29, 2025
2348c11
Merge branch 'develop' into 1266-feature-investigate-varargs-cg
moebarni Jul 30, 2025
07de6b4
fixed format
moebarni Jul 30, 2025
706fc81
changed preanalysis data structure to Table
moebarni Jul 30, 2025
bc8763d
formatting
moebarni Jul 30, 2025
2988813
Merge branch 'develop' into 1266-feature-investigate-varargs-cg
moebarni Jul 30, 2025
19397b2
deleted duplicate getDeclClassType-method; add methodName-subtype pai…
moebarni Jul 31, 2025
5a00c10
updated methodName-subType pairs
moebarni Aug 1, 2025
5261278
rollback collectInstantiatedClassesInMethod
moebarni Aug 3, 2025
ba19f9b
fmt
moebarni Aug 3, 2025
a8aa9d6
structural changes (getMethodsWithPolymorphicAnnotation)
moebarni Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
formatting
  • Loading branch information
moebarni committed Jul 30, 2025
commit bc8763ddbc36d54b643324d036349e275c3f759c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@

import static sootup.core.jimple.basic.StmtPositionInfo.getNoStmtPositionInfo;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -81,24 +80,31 @@ protected AbstractCallGraphAlgorithm(@NonNull View view) {
* @return a list of method signatures annotated with {@code @PolymorphicSignature}
*/
protected Table<String, String, SootMethod> getMethodsWithPolymorphicAnnotation() {
Table<String, String, SootMethod> polymorphicMethods = HashBasedTable.create();
ClassType polymorphicAnnotationType =
view.getIdentifierFactory()
.getClassType("java.lang.invoke.MethodHandle$PolymorphicSignature");
view.getClasses()
.filter(sootClass -> sootClass instanceof JavaSootClass) // TODO: currently must be instanceof JavaSootClass
.map(sootClass -> (JavaSootClass) sootClass)
.flatMap(javaSootClass -> javaSootClass.getMethods().stream())
.forEach(javaSootMethod -> {
Table<String, String, SootMethod> polymorphicMethods = HashBasedTable.create();
ClassType polymorphicAnnotationType =
view.getIdentifierFactory()
.getClassType("java.lang.invoke.MethodHandle$PolymorphicSignature");
view.getClasses()
.filter(
sootClass ->
sootClass
instanceof JavaSootClass) // TODO: currently must be instanceof JavaSootClass
.map(sootClass -> (JavaSootClass) sootClass)
.flatMap(javaSootClass -> javaSootClass.getMethods().stream())
.forEach(
javaSootMethod -> {
Iterable<AnnotationUsage> annotationUsages = javaSootMethod.getAnnotations();
for (AnnotationUsage annotationUsage : annotationUsages) {
if (annotationUsage.getAnnotation().equals(polymorphicAnnotationType)) {
polymorphicMethods.put(javaSootMethod.getName(), javaSootMethod.getDeclClassType().toString(), javaSootMethod);
break;
}
if (annotationUsage.getAnnotation().equals(polymorphicAnnotationType)) {
polymorphicMethods.put(
javaSootMethod.getName(),
javaSootMethod.getDeclClassType().toString(),
javaSootMethod);
break;
}
}
});
return polymorphicMethods;
});
return polymorphicMethods;
}

/**
Expand Down Expand Up @@ -703,10 +709,12 @@ protected Optional<? extends SootMethod> findMatchingVarArgsMethod(
@NonNull MethodSignature targetMethodSignature) {
String targetName = targetMethodSignature.getName();
if (preanalysis.containsRow(targetName)) {
String targetDeclClass = targetMethodSignature.getDeclClassType().toString();
if (preanalysis.containsColumn(targetDeclClass)) { // TODO: no use of the Annotation PolymorphicSignature outside of the package -> no custom subclasses possible
return Optional.ofNullable(preanalysis.get(targetName, targetDeclClass));
}
String targetDeclClass = targetMethodSignature.getDeclClassType().toString();
if (preanalysis.containsColumn(
targetDeclClass)) { // TODO: no use of the Annotation PolymorphicSignature outside of the
// package -> no custom subclasses possible
return Optional.ofNullable(preanalysis.get(targetName, targetDeclClass));
}
}
logger.warn(
"Could not find \""
Expand Down