[Soot-list] Java-To-Jimple

Barthelemy Dagenais barthed at hotmail.com
Wed Nov 23 11:48:33 EST 2005


I think I found the source of the problem (when using Java-To-Jimple 
conversion, compiled classes are not found by the compiler).

The classpath used by Polyglot to load a class definition is not the same as 
the one provided by the command line arguments list when executing soot.

At some point in the java to jimple conversion, an ast is created and more 
precisely, a type system is initialized with its class loader. The problem 
is in the AbstractExtensionInfo (in initCompiler method) which creates a 
default Options instance with a default classpath. This is this default 
classpath that is given to the class loader that will be responsible of 
finding class files.

The Options instance should be initialized with the classpath given to the 
soot main application. Here is the initialization stack of the compiler:

        at 
polyglot.ext.jl.types.TypeSystem_c.initialize(TypeSystem_c.java:37)
        at 
polyglot.ext.jl.ExtensionInfo.initTypeSystem(ExtensionInfo.java:60)
        at 
polyglot.frontend.AbstractExtensionInfo.initCompiler(AbstractExtensio
nInfo.java:80)
        at polyglot.frontend.Compiler.<init>(Compiler.java:63)
        at polyglot.frontend.Compiler.<init>(Compiler.java:45)
        at 
soot.javaToJimple.InitialResolver.formAst(InitialResolver.java:96)
        at soot.JavaClassSource.resolve(JavaClassSource.java:46)
        at soot.SootResolver.bringToHierarchy(SootResolver.java:152)
        at soot.SootResolver.bringToSignatures(SootResolver.java:179)
        at soot.SootResolver.processResolveWorklist(SootResolver.java:105)
        at soot.SootResolver.resolveClass(SootResolver.java:90)
        at soot.Scene.loadClass(Scene.java:329)
        at soot.Scene.loadClassAndSupport(Scene.java:314)
        at soot.Scene.loadNecessaryClass(Scene.java:861)
        at soot.Scene.loadNecessaryClasses(Scene.java:880)
        at soot.Main.run(Main.java:178)
        at soot.Main.main(Main.java:153)

The workaround I found for now is to put the required library in the 
CLASSPATH system variable. I will also try to implement a new ExtensionInfo 
in order to create a valid Options instance.

Regards,
Barthelemy

----Original Message Follows----
From: "Barthelemy Dagenais" <barthed at hotmail.com>
To: soot-list at sable.mcgill.ca
Subject: [Soot-list] Java-To-Jimple
Date: Tue, 22 Nov 2005 11:39:31 -0500

Hi,

I'm trying to parse a java project with Soot. I would like to transform java 
file to jimple and this works well with the src_prec option set to java. My 
problem is when the source code depends on compiled classes in an external 
jar. Even if the jar is in the classpath, I receive an exception like this 
one:

C:\Java\workspace_clean\LibProject\src\ca/uqam/test/Application1.java: Class
    "org.apache.commons.cli.Options" not found.

soot.CompilationDeathException: Could not compile
	at soot.javaToJimple.JavaToJimple.compile(JavaToJimple.java:162)
	at soot.javaToJimple.InitialResolver.formAst(InitialResolver.java:35)
	at soot.SootResolver.resolveClassAndSupportClasses(SootResolver.java:135)
	at soot.Scene.loadClassAndSupport(Scene.java:255)
	at soot.Scene.loadNecessaryClasses(Scene.java:642)
...

Is there a way to transform source files that depends on compiled classes?

The code is transformed without problem if I only provide the class files 
without the sources.

Regards,
Barthelemy


_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list




More information about the Soot-list mailing list