[Soot-list] Class Loading - Bug or Feature?

Marc-André Laverdière marc-andre.laverdiere-papineau at polymtl.ca
Tue Mar 18 16:00:53 EDT 2014


Hello everybody,

There are things about Soot's bug loading that I don't know if they are
bugs, or features meant to save memory. This is one of them.

The problem I have is that I often need to ask the question "Which
classes implement interface X?" and "which classes are subclasses of Y?"
And the current class loading is leaving me high and dry.

Here is a simple test case that shows how the current class loading can
break:

G.reset();
Options.v().set_prepend_classpath(true);
Options.v().set_time(false);
Scene.v().addBasicClass("java.util.List");
Scene.v().loadNecessaryClasses();
SootClass arrayList = Scene.v().getSootClass("java.util.ArrayList");
Hierarchy h = new Hierarchy();

//This test works only if java.util.ArrayList is added as a basic class
//Or if ArrayList is loaded with forceResolve
assertTrue("ArrayList should be an implementer of List",
h.getImplementersOf(list).contains(arrayList));

The test is false. There are no classes implementing List as far as Soot
can see.

Is this behavior something wanted (a feature)? Or is it a bug?

This can be avoided easily by using Scene.forceResolve on all dandling
classes. If this is a bug, I'll open a bug in Github and add that
resolution step. If it is a feature, should we add a command-line flag
for Soot to perform the additional resolution for people like me who
need it?

Regards,

-- 
Marc-André Laverdière-Papineau
Doctorant - PhD Candidate


More information about the Soot-list mailing list