[Soot-list] Class path problem, cant find java.lang.CharSequence

Steven Arzt Steven.Arzt at cased.de
Tue Apr 21 05:54:17 EDT 2015


Do you try to load your program under analysis from source code or bytecode?

 

Additionally, you use a very non-standard way of initializing Soot. Especially, you never load the basic Java classes, you only set the options. You normally also have to do this after all options are set and before you do anything else:

 

                Scene.v().loadNecessaryClasses();

 

Then, you enable certain Soot phases (why, btw.?), but you never run the Soot packs:

 

       PackManager.v().runPacks();

 

For simplicity, you might even be better off by simply calling Soot’s main method and just hook in using custom transformers instead of manually invoking the Soot API methods.

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Marcelino Rodriguez Cancio
Gesendet: Dienstag, 21. April 2015 09:57
An: Steven Arzt
Cc: soot-list at CS.McGill.CA
Betreff: Re: [Soot-list] Class path problem, cant find java.lang.CharSequence

 

Hi Steven,

 

Tried without replacing and still no good.

 

Best

Marcelino

 

2015-04-20 16:35 GMT+02:00 Steven Arzt <Steven.Arzt at cased.de>:

Hi Marcelino,

 

why do you replace the backslahes in your Soot classpath by slashes? Soot will automatically pick the correct path delimiter for your operating system. Using a slash on Windows may lead to issues as the path separator is a backslash on Windows.

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Marcelino Rodriguez Cancio
Gesendet: Montag, 20. April 2015 16:31
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] Class path problem, cant find java.lang.CharSequence

 

Hi all,

 

I’m trying to run one of the Soot examples found in the wiki in all classes in a directory. But got this error:

 

resolving [from .java]: TestClass1

Exception in thread "main" java.lang.Error: Error loading java.lang.CharSequence

            at soot.JastAddJ.PathPart.getCompilationUnit(PathPart.java:128)

            at soot.JastAddJ.Program.getCompilationUnit(Program.java:858)

            at soot.JastAddJ.Program.getLibCompilationUnit_compute(Program.java:1531)

            at soot.JastAddJ.Program.getLibCompilationUnit(Program.java:1514)

            at soot.JastAddJ.Program.lookupLibType_compute(Program.java:1479)

            at soot.JastAddJ.Program.lookupLibType(Program.java:1447)

            at soot.JastAddJ.Program.lookupType_compute(Program.java:1426)

            at soot.JastAddJ.Program.lookupType(Program.java:1407)

            at soot.JastAddJ.Program.Define_TypeDecl_lookupType(Program.java:1995)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

            at soot.JastAddJ.Expr.lookupType(Expr.java:1186)

            at soot.JastAddJ.TypeAccess.decls_compute(TypeAccess.java:425)

            at soot.JastAddJ.TypeAccess.decls(TypeAccess.java:414)

            at soot.JastAddJ.TypeAccess.refined_TypeScopePropagation_TypeAccess_decl(TypeAccess.java:387)

            at soot.JastAddJ.TypeAccess.decl_compute(TypeAccess.java:460)

            at soot.JastAddJ.TypeAccess.decl(TypeAccess.java:452)

            at soot.JastAddJ.TypeAccess.type_compute(TypeAccess.java:590)

            at soot.JastAddJ.TypeAccess.type(TypeAccess.java:583)

            at soot.JastAddJ.ParameterDeclaration.type_compute(ParameterDeclaration.java:479)

            at soot.JastAddJ.ParameterDeclaration.type(ParameterDeclaration.java:472)

            at soot.JastAddJ.MethodDecl.signature_compute(MethodDecl.java:1355)

            at soot.JastAddJ.MethodDecl.signature(MethodDecl.java:1343)

            at soot.JastAddJ.TypeDecl.localMethodsSignatureMap_compute(TypeDecl.java:2527)

            at soot.JastAddJ.TypeDecl.localMethodsSignatureMap(TypeDecl.java:2515)

            at soot.JastAddJ.ClassDecl.methodsSignatureMap_compute(ClassDecl.java:1102)

            at soot.JastAddJ.ClassDecl.methodsSignatureMap(ClassDecl.java:1094)

            at soot.JastAddJ.TypeDecl$2.<init>(TypeDecl.java:468)

            at soot.JastAddJ.TypeDecl.methodsIterator(TypeDecl.java:467)

            at soot.JastAddJ.TypeDecl.methodsNameMap_compute(TypeDecl.java:2468)

            at soot.JastAddJ.TypeDecl.methodsNameMap(TypeDecl.java:2459)

            at soot.JastAddJ.TypeDecl.memberMethods(TypeDecl.java:2431)

            at soot.JastAddJ.AbstractDot.Define_Collection_lookupMethod(AbstractDot.java:766)

            at soot.JastAddJ.Expr.lookupMethod(Expr.java:1032)

            at soot.JastAddJ.MethodAccess.decls_compute(MethodAccess.java:1094)

            at soot.JastAddJ.MethodAccess.decls(MethodAccess.java:1086)

            at soot.JastAddJ.MethodAccess.decl_compute(MethodAccess.java:1128)

            at soot.JastAddJ.MethodAccess.decl(MethodAccess.java:1120)

            at soot.JastAddJ.MethodAccess.refined_TypeAnalysis_MethodAccess_type(MethodAccess.java:913)

            at soot.JastAddJ.MethodAccess.type_compute(MethodAccess.java:1264)

            at soot.JastAddJ.MethodAccess.type(MethodAccess.java:1249)

            at soot.JastAddJ.AbstractDot.type_compute(AbstractDot.java:604)

            at soot.JastAddJ.AbstractDot.type(AbstractDot.java:597)

            at soot.JastAddJ.IfStmt.typeCheck(IfStmt.java:138)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1284)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.ASTNode.collectErrors(ASTNode.java:1292)

            at soot.JastAddJ.CompilationUnit.errorCheck(CompilationUnit.java:178)

            at soot.JastAddInitialResolver.formAst(JastAddInitialResolver.java:58)

            at soot.JavaClassSource.resolve(JavaClassSource.java:54)

            at soot.SootResolver.bringToHierarchy(SootResolver.java:237)

            at soot.SootResolver.bringToSignatures(SootResolver.java:264)

            at soot.SootResolver.bringToBodies(SootResolver.java:302)

            at soot.SootResolver.processResolveWorklist(SootResolver.java:161)

            at soot.SootResolver.resolveClass(SootResolver.java:129)

            at soot.Scene.loadClass(Scene.java:694)

            at soot.Scene.loadClassAndSupport(Scene.java:679)

            at fr.irisa.diverse.SwapSootMain.main(SwapSootMain.java:48)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:483)

            at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

 

I tried both command line and manually calling the Soot API, so far no look, same error both.

 

Here is my code for the command line:

 

String[] sootParams = new String[] { "-cp", ".", "-pp", "-process-dir",  p.getProperty("cp"), "-d", p.getProperty("output"), "-v" };

soot.Main.main(sootParams);

 

===============

 

And here is my code for the manual calls to the API:

 

    public static void configure(String classpath) {

        Options.v().set_verbose(true);

        Options.v().set_process_dir(Arrays.asList(classpath));

        Options.v().set_keep_line_number(true);

        Options.v().set_src_prec(Options.src_prec_class);

 

        String cp = System.getProperty("java.class.path").replace("\\", "/");

        Options.v().set_soot_classpath(cp);

 

        Options.v().set_prepend_classpath(true);

        Options.v().set_allow_phantom_refs(true);

 

        PhaseOptions.v().setPhaseOption("bb", "off");

        PhaseOptions.v().setPhaseOption("tag.ln", "on");

        PhaseOptions.v().setPhaseOption("jj.a", "on");

        PhaseOptions.v().setPhaseOption("jj.ule", "on");

 

        Options.v().set_whole_program(true);

    }

 

    public static void main(String[] args) throws IOException {

        Properties p = new Properties();

        p.load(SwapSootMain.class.getClassLoader().getResourceAsStream("soot.properties"));

 

        configure(p.getProperty("cp"));

 

        SootClass c = Scene.v().loadClassAndSupport("TestClass1");

        c.setApplicationClass();

        // Retrieve the method and its body

        SootMethod m = c.getMethodByName("foo");

        Body b = m.retrieveActiveBody();

        // Instruments bytecode

        new GuaranteedDefs(new ExceptionalUnitGraph(b));

            }

 

Here is the value of the System.getProperty("java.class.path").replace("\\", "/"):

 

C:/Program Files/Java/jdk1.8.0_05/jre/lib/resources.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/rt.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/access-bridge-64.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/cldrdata.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/dnsns.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/jaccess.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/jfxrt.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/localedata.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/nashorn.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/sunec.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/sunjce_provider.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/sunmscapi.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/sunpkcs11.jar

C:/Program Files/Java/jdk1.8.0_05/jre/lib/ext/zipfs.jar

C:/MarcelStuff/PROJECTS/DIVERSE/soot-example/target/classes

C:/Users/marodrig/.m2/repository/edu/sable/soot/nightly-build/soot-nightly-build.jar

C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community Edition 14.0.2/lib/idea_rt.jar

 

Any ideas what could be happening?

 

Thanks you all. 

Marcelino

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150421/51b8a01a/attachment-0001.html 


More information about the Soot-list mailing list