soot-oss / soot

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

Java 8 support for soot.JastAddJ.ByteCodeParser #394

Open ericbodden opened 9 years ago

ericbodden commented 9 years ago

Soot's source-code frontend is currently built on top of JastAdd

This frontend uses a custom bytecode parser: soot.JastAddJ.ByteCodeParser

Why that is, I am not entirely sure.

In any case, this parser currently crashes on reading certain Java8 bytecodes, e.g. MethodHandles in the constant pool. Even worse, ByteCodeParser even exits Soot completely using System.exit(1) !

https://github.com/Sable/soot/blob/develop/generated/jastadd/soot/JastAddJ/BytecodeParser.java#L257

ericbodden commented 9 years ago

We should probably contact the JastAdd guys about this.

ericbodden commented 9 years ago

Created an issue for JastAdd https://bitbucket.org/jastadd/jastadd2/issue/213/current-bytecodeparser-for-soot-does-not

JonathanAldrich commented 7 years ago

Hi, any news on the status of this? It would be nice if Soot could handle Java 8 bytecode. I took a quick look at the problem but I'm missing a lot of context both on the internals of Soot and JastAdd/ExtendJ, so it would be nontrivial for me to delve into it myself.

JonathanAldrich commented 7 years ago

I made an interesting observation: this problem shows up when using a Java 8 VM even when compiling Java 7 code, targeting Java 7 bytecode, and specifying the Java 7 rt.jar file. This seemed odd. I discovered that soot\generated\jastadd\soot\JastAddJ\Program.java looks for libraries from the bootclasspath before libraries specified via Soot's -cp option. Reversing the order in which libraries are added to the search path is a workaround (and probably the right thing to do anyway--I can submit a PR if you think this is of general interest--just let me know by replying to this comment).

I'm still not quite where I want to be, because the develop branch seems to use some Java 8 library features and is thus incompatible with Java 7, whereas the master branch is so old it doesn't have the line number commit from 3 years ago yet. What do you use for the nightly build? It can't be the develop branch per se because the nightly build jar does seem to work with Java 7... I'd like to apply my patch to whatever code produced the last nightly build (looks like January 8, 2017).

ericbodden commented 7 years ago

Hi Jonathan. I'd suggest to wait until we have integrated our new Java 8 support (see separate email). If the problem then still persists, we should definitely look into it. Thanks for raising it!

chengxuanxie commented 6 years ago

hey guys does soot support java 8 now? It's important for me to know if soot supports java 8,thanks!