SootUp
SootUp copied to clipboard
[Feature]: Method calls sorted by sequence
Missing Feature
callFrom(methodSignature) returns a no-sorted set, consider making a sorted list by the call sequence?
I'm currently doing a research of type-bug
Suppose i have a program below
public class A {
private int m() { System.out.println("A.m"); return 0; }
public static void main(String... args) { type_bug.refined.B b = new type_bug.refined.C(); b.m(); }
}
abstract class B extends A implements I {
}
class C extends B {
public void m() { System.out.println("C.m"); }
}
interface I {
public void m();
}
i use the following code to get the Methods called in A.main()
final ViewTypeHierarchy typeHierarchy = new ViewTypeHierarchy(view);
CallGraphAlgorithm cha = new ClassHierarchyAnalysisAlgorithm(view);
// Create CG by initializing CHA with entry method(s)CallGraph cg = cha.initialize(Collections.singletonList(methodSignature));
cg.callsFrom(methodSignature).forEach(System.out::println);
i got the following output:
<type_bug.refined.C: void m()>
<type_bug.refined.C: void
while the correct sequence should be like:
<type_bug.refined.C: void
i wonder if there is a way to sort the method call correctly😊