[Soot-list] java.lang.RuntimeException: cannot set body for non-concrete method!

Michael Faes rolve at trick17.ch
Mon Jan 21 09:05:32 EST 2013


Hi everyone,

I'm using Soot for a deadlock analysis tool and I'm encountering the
following exception:

java.lang.RuntimeException: cannot set body for non-concrete method!
<micro.chain.Service4: void doSomething()>
   at soot.SootMethod.setActiveBody(SootMethod.java:338)
   at soot.SootMethod.retrieveActiveBody(SootMethod.java:322)
   at ...OnFlyCallGraphBuilder.processNewMethod(...)
   at ...OnFlyCallGraphBuilder.processReachables(...)
   at ...CallGraphBuilder.build(CallGraphBuilder.java:84)
   at ...CHATransformer.internalTransform(CHATransformer.java:43)
   at soot.SceneTransformer.transform(SceneTransformer.java:39)
   at soot.Transform.apply(Transform.java:89)
   at soot.RadioScenePack.internalApply(RadioScenePack.java:57)
   at ...CallGraphPack.internalApply(CallGraphPack.java:49)
   at soot.Pack.apply(Pack.java:114)
   at soot.PackManager.runWholeProgramPacks(PackManager.java:412)
   at soot.PackManager.runPacks(PackManager.java:336)
   at deadlockfinder.DeadlockFinder.findDeadlocks(DeadlockFinder.java:98)

The Service4 interface is very simple:

public interface Service4 {
     void doSomething();
     void doSomethingElse();
}

I found another message on this list that is probably about the same 
issue 
(http://www.sable.mcgill.ca/pipermail/soot-list/2012-January/004055.html) but 
the answers didn't help me.

I don't use the Soot main method as I am loading classes and setting 
custom entry points before running the packs. Here is what my main 
method roughly looks like:

-----------------------------------------------------------
final soot.options.Options opts = soot.options.Options.v();
final Scene scene = Scene.v();

opts.set_output_format(soot.options.Options.output_format_none);
opts.set_via_shimple(true);
opts.set_whole_program(true);
opts.set_whole_shimple(true);
opts.set_omit_excepting_unit_edges(true);
opts.set_no_bodies_for_excluded(true);
opts.set_allow_phantom_refs(true);
opts.set_exclude(Arrays.asList("java.", "javax."));
List<String> classes = ...
opts.parse(classes.toArray(
         new String[classes.size()]));

for(final Object name : opts.classes())
     scene.forceResolve((String) name, SootClass.BODIES);

final String[] additionalClasses =
         new String[]{"java.util.concurrent.locks.Lock"};
for(final String className : additionalClasses)
     scene.forceResolve(className, SootClass.SIGNATURES);

scene.loadNecessaryClasses();
scene.setEntryPoints(SootUtils.allPublicMethods());
scene.setDefaultThrowAnalysis(new NoVmErrorsThrowAnalysis());

final LogConstructor logConstructor = new LogConstructor(options);
final LogCyclesFinder logCycles = new LogCyclesFinder(logConstructor);
PackManager.v().getPack("wstp").add(
         new Transform("wstp.logconstruct", logConstructor));
PackManager.v().getPack("wstp").add(
         new Transform("wstp.logcycles", logCycles));

PackManager.v().runPacks();
-----------------------------------------------------------

I understand that the allow_phantom_refs option may cause this problem, 
but I can't disable it as the analysis would take far too long if the 
JDK was included.

Am I doing something wrong or is this a bug? Can I somehow circumvent 
it? Any help is much appreciated.

Thanks,
Michael


More information about the Soot-list mailing list