[Soot-list] Call graph behavior with interfaces and no concrete implementations

Hal Hildebrand hal.hildebrand at gmail.com
Wed Aug 11 18:55:14 EDT 2010


I'm noticing that I do not seem to have edges to calls on interface signatures unless I provide a concrete implementation of the interface in the application set of classes.  Here's a concrete example of what I'm testing:

interface Y
	method foo();

public class X
	Y y;

	public void a() {
		b();
	}

	public void b() {
		y.foo();
	}

No, granted I'm already off the reservation with my usage of the call graph structure in Soot, but here's what I'm doing.  Before constructing the call graph, I'm setting the entry points in the Scene to all the non-private methods of the set all the application classes.  Using the constructed call graph, I then examine the targets of the edges out of a method.  So, using the classes above, I'd be examining class X and method b().  I would expect to see Y.foo() as part of this set, but if I only provide the interface, I do no edges from X.b().  If I provide a concrete implementation of the interface Y, however, when I examine the targets of X.b(), I find Y.foo().  This seems counter intuitive to me, given that nowhere in the code is the concrete implementation actually constructed or referenced.

The reason why this is important to me, rather than just an interesting curiosity, is that my inference analysis needs to deal with just interfaces on the boundaries of decoupled systems (the common pattern).  Consequently, when analyzing system X, certainly a common case will be interface calls, with implementations in some decoupled systems not considered in the analysis set.

Again, I understand I'm off the reservation with my creative use of the entry points - rather than a single application main - as well as the use of the new and exciting option:

        Options.v().set_no_bodies_for_excluded(true);

Is there something I can do, or something I'm doing which I shouldn't, which would make this scenario work with Soot?

Thanks,

Hal


More information about the Soot-list mailing list