soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.87k stars 707 forks source link

Branch Java9 can't Resolve List<String> infos=new ArrayList<>() #939

Closed zhenyuqiaotencent closed 6 years ago

zhenyuqiaotencent commented 6 years ago

I had asked a same question before and the reply declare the branch java9 can solve this issue!

I switch to branch Java9 and the code can't be resolved the example code

public static void main(String[] args) { String data = "Hello World!"; List infos=new ArrayList<>(); }

the method stack Exception in thread "main" 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:264) at soot.SootResolver.bringToHierarchy(SootResolver.java:231) at soot.SootResolver.bringToSignatures(SootResolver.java:297) at soot.SootResolver.processResolveWorklist(SootResolver.java:193) at soot.SootResolver.resolveClass(SootResolver.java:154) at soot.Scene.loadClass(Scene.java:863) at soot.Scene.loadClassAndSupport(Scene.java:849) at soot.Main.main(Main.java:191)

the error message can not assign variable infos of type java.util.List a value of type java.util.ArrayList<@primitive.Unknown>

_15249025859252 1 2

anddann commented 6 years ago

Okay, what cmd line arguments do you use? It seems use the Jast(Java Frontend), which is outdated. I recommend using the asm frontend and using only *.class as input, but no Java source code

zhenyuqiaotencent commented 6 years ago

I didn't use any cmd line arguments, just make the soot load the special source code to verify the jast grammar.

it's not the Jast, it's the java lambda grammar, the next code also can't resolved, it can't confirm the type of the object 'e'

show.addActionListener((e) -> { System.out.println("Light, Camera, Action !! Lambda expressions Rocks"); });

Is there any other way to support those java lambda grammar?

it's difficult for me to get the asm or *.class as input, the code project is so big and I want to use the Soot as an IDE plugin to provide special service! @anddann

zhenyuqiaotencent commented 6 years ago

I solve this issue by using the .class as input!