Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue loading Java Class #1140

Closed
franceme opened this issue Apr 9, 2019 · 2 comments
Closed

Issue loading Java Class #1140

franceme opened this issue Apr 9, 2019 · 2 comments

Comments

@franceme
Copy link

franceme commented Apr 9, 2019

  • Soot Version - 3.3.0_Nightly-With-Dependencies
  • Java Version (Stable) - 1.7.80
  • Java Version (Issue) - 1.8.192
  • Steps to reproduce - I can attach steps to reproduce later if needed.

Currently within my project, this scenario reads in a single java file (*.java), loads it into Soot's Scene, scans it, and displays information.

The java class loading method (used and working in other scenarios) is as shown below.

Options.v().setsrc_prec(Options.src_prec_only_class);
Options.v().set_output_format(Options.output_format_jimple);
...
Options.v().set_prepend_classpath(true);
Options.v().set_whole_program(true);
...
Options.v().set_keep_line_number(true);
Options.v().set_allow_phantom_refs(true);
...
/**
 * Java File Package = tester
 * Java File = UrlFrameWorks.java
 *
 * variable clazz = tester.UrlFrameWorks
**/
Scene.v().loadClassAndSupport(clazz);

When the project is run on Java 1.7.80, the java file is loaded successfully and scanned with no issues.
However when run with the later Java Version (1.8.192), it throws a failure loading java.lang.CharSequence.
A trimmed excerpt of the stacktrace is shown below.

java.lang.Error: Error: Failed to load java.lang.CharSequence.
	at soot.JastAddJ.PathPart.getCompilationUnit(PathPart.java:109)
	at soot.JastAddJ.Program.getCompilationUnit(Program.java:873)
	at soot.JastAddJ.Program.getLibCompilationUnit_compute(Program.java:1517)
	at soot.JastAddJ.Program.getLibCompilationUnit(Program.java:1500)
	at soot.JastAddJ.Program.lookupLibType_compute(Program.java:1465)
	at soot.JastAddJ.Program.lookupLibType(Program.java:1433)
	at soot.JastAddJ.Program.lookupType_compute(Program.java:1412)
	at soot.JastAddJ.Program.lookupType(Program.java:1393)
	at soot.JastAddJ.Program.Define_TypeDecl_lookupType(Program.java:1981)
	at soot.JastAddJ.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1657)

Is there an extra step to be called due to the version upgrade?


An important note to add, the java file being loaded may or may not have the entry point (main(...)) of the entire program.

@franceme
Copy link
Author

I would like to add the following update.

It seems as though this is an issue when using any version of Java past 1.7.
I have found this due to the following other related issues: 775 and 896.

As the new question (or clarification), scanning Java source files (*.java) are not supported?

@anddann
Copy link
Member

anddann commented Apr 10, 2019

Unfortunately, the Java Source Code frontend is outdated.
I suggest to use Soot's ASM bytecode frontend. It supports more
language features and is more powerful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants