[Soot-list] 答复: soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)

周 筱川 cobra at live.com
Wed Aug 22 09:57:33 EDT 2018


Hi there ,
     I figured out the previous problem . as Bernhard said ,I should compile the .java files to .class files first while working with JDK8 . It is also indicated in a official tutorial( https://github.com/Sable/soot/wiki/Introduction:-Soot-as-a-command-line-tool )<https://github.com/Sable/soot/wiki/Introduction:-Soot-as-a-command-line-tool>


Now, if you're working with JDK8, these Java files need to be compiled before they can be passed on as command-line parameters


but there's another problem  when handling a class with package


Java code

package TriangleClass;

public class Triangle {
    public String triangle(int a, int b, int c){

        if(a > 0 && b > 0 && c >0){
            if(a + b >c)
            {
                if(a == b || b ==c || a ==c)
                {
                    if(a == b && b == c)
                    {
                        return "equilateral";
                    }
                    return "isosceles";
                }
                else{
                    return "scalene";
                }
            }
            else{
                return "Not Triangle";
            }
        }
        else{
            return "Not Triangle";
        }
    }

    public int a;
    public int b;
    public int c;
}

I compile it into a .class file ,then tried two different commands  as follows:


D:\flowproject\soot\test>java -cp soot-trunk.jar soot.Main -cp .;rt.jar Triangle
Soot started on Wed Aug 22 21:37:47 CST 2018
java.lang.RuntimeException: Class names not equal! TriangleClass.Triangle != Triangle
        at soot.asm.SootClassBuilder.visit(SootClassBuilder.java:99)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:637)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:521)
        at soot.asm.AsmClassSource.resolve(AsmClassSource.java:62)
        at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:240)
        at soot.SootResolver.bringToHierarchy(SootResolver.java:212)
        at soot.SootResolver.bringToSignatures(SootResolver.java:273)
        at soot.SootResolver.processResolveWorklist(SootResolver.java:174)
        at soot.SootResolver.resolveClass(SootResolver.java:137)
        at soot.Scene.loadClass(Scene.java:861)
        at soot.Scene.loadClassAndSupport(Scene.java:847)
        at soot.Scene.loadNecessaryClass(Scene.java:1577)
        at soot.Scene.loadNecessaryClasses(Scene.java:1590)
        at soot.Main.run(Main.java:248)
        at soot.Main.main(Main.java:144)



D:\flowproject\soot\test>java -cp soot-trunk.jar soot.Main -d ./xxx -cp .;rt.jar TriangleClass.Triangle
Soot started on Wed Aug 22 21:38:04 CST 2018
soot.SootResolver$SootClassNotFoundException: couldn't find class: TriangleClass.Triangle (is your soot-class-path set properly?)
        at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:232)
        at soot.SootResolver.bringToHierarchy(SootResolver.java:212)
        at soot.SootResolver.bringToSignatures(SootResolver.java:273)
        at soot.SootResolver.processResolveWorklist(SootResolver.java:174)
        at soot.SootResolver.resolveClass(SootResolver.java:137)
        at soot.Scene.loadClass(Scene.java:861)
        at soot.Scene.loadClassAndSupport(Scene.java:847)
        at soot.Scene.loadNecessaryClass(Scene.java:1577)
        at soot.Scene.loadNecessaryClasses(Scene.java:1590)
        at soot.Main.run(Main.java:248)
        at soot.Main.main(Main.java:144)



when I handle a simple class without package , it can be done successfully.


Example


    public class GetGreeting
    {
        public static void main(String [] args)
        {
            System.out.println("Hello world");

        }
    }


I've searched  anything about the error messages  a long time online , still without a clue .

please help ,  thank you!



________________________________
发件人: 周 筱川 <cobra at live.com>
发送时间: 2018年8月20日 6:25
收件人: Bernhard Berger
抄送: soot-list at CS.McGill.CA
主题: 答复: [Soot-list] soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)

Thank you Bernhard , i'll try again and give a feedback later.
________________________________
发件人: Bernhard Berger <berber at tzi.de>
发送时间: 2018年8月20日 6:19
收件人: 周 筱川
抄送: soot-list at CS.McGill.CA
主题: Re: [Soot-list] soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)

Hi,

please try to compile your source code using javac and analyze the bytecode instead of the source. As far as I know, the bytecode front end is better supported than the source front end.

Regards, Bernhard

On 20 Aug 2018, at 05:38, 周 筱川 <cobra at live.com<mailto:cobra at live.com>> wrote:

Hi there,
    I'm a beginner for Soot, while trying to parse some java files , there's an error "soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)".
   Thank you very much for any advice!

Detail as follows:

Tried commands:
java -cp D:\flowproject\soot\sootclasses-trunk-jar-with-dependencies.jar -debug  soot.Main  -cp . CardQueryService
java -cp D:\flowproject\soot\sootclasses-trunk-jar-with-dependencies.jar soot.Main --soot-classpath .;"%JAVA_HOME%"\jre\lib\rt.jar  CardQueryService

Error Message
Soot started on Mon Aug 20 11:20:20 CST 2018
soot.CompilationDeathException: there were errors during parsing and/or type checking (JastAdd frontend)
        at soot.JastAddInitialResolver.formAst(JastAddInitialResolver.java:66)
        at soot.JavaClassSource.resolve(JavaClassSource.java:57)
        at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:240)
        at soot.SootResolver.bringToHierarchy(SootResolver.java:212)
        at soot.SootResolver.bringToSignatures(SootResolver.java:273)
        at soot.SootResolver.processResolveWorklist(SootResolver.java:174)
        at soot.SootResolver.resolveClass(SootResolver.java:137)
        at soot.Scene.loadClass(Scene.java:861)
        at soot.Scene.loadClassAndSupport(Scene.java:847)
        at soot.Scene.loadNecessaryClass(Scene.java:1577)
        at soot.Scene.loadNecessaryClasses(Scene.java:1590)
        at soot.Main.run(Main.java:248)
        at soot.Main.main(Main.java:144)

Java File Example:
   plz see the attachment





<CardQueryService.java>_______________________________________________
Soot-list mailing list
Soot-list at CS.McGill.CA<mailto:Soot-list at CS.McGill.CA>
https://mailman.CS.McGill.CA/mailman/listinfo/soot-list<https://mailman.cs.mcgill.ca/mailman/listinfo/soot-list>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180822/ad0283fa/attachment-0001.html>


More information about the Soot-list mailing list