Closed miguelvelezmj25 closed 3 years ago
Currently, all calls must be either to the JRE or to a file included via -c
or -i
. In the future we may handle library calls, but for the moment you can ask maven to download the sources and include them (you may need to unpack the corresponding jar
file).
I see. However, I do not think that handling library calls will be that difficult. Based on JavaParser's ReflectionTypeSolver's docs: "Uses reflection to resolve types. Classes on the classpath used to run your application will be found. No source code is available for the resolved types". That is why the JRE libraries are resolved, because they are loaded into the JVM when running JavaSDGSlicer.
I change this to false
, added the hello.Hello
.class files to the classpath when running JavaSDGSlicer for the program above, and I did not get an error!
I'll document this option for other users, then.
The only problem of including libraries this way is that our handling of JRE calls is somewhat lacking. We assume that all arguments are needed but none are modified. The correct approach would be to assume that all arguments and the scope are read and modified. Our current approach is temporary, to avoid all System.out.println
calls being included unnecessarily*.
stdout
, so every subsequent print is dependent on it.
Thank you for fixing the usage of option
-i
!I was now wondering if JavaSDGSlicer has some option or strategy that I could use to avoid getting an error when the project that I want to analyze has dependencies for which (1) I do not have access to the source code and (2) I am not really interested in the analysis in those methods/classes. For example, if I want to analyze this code
I am not really interested to do any analysis in
Hello.number();
and any other calls that happen within that method. Still, I get the following error:However, I do not get an error when making calls to the Java runtime libraries. I think I do not get an error with the Java runtime libraries because of how Java parser is configured with this TypeSolver.addTypeSolverJRE();.
Is there something similar to resolve project dependencies?