SootUp
SootUp copied to clipboard
[Bug]: PTAScene cannot be created when using PTAFactory.createPTA
What happened?
Hello, thank you for SootUp's contributions to the static analysis industry—it's truly meaningful. While attempting to use pointer analysis, I encountered the following BUG:
java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:143)
at qilin.core.ArtificialMethod.addInvoke(ArtificialMethod.java:138)
at qilin.core.builder.FakeMainFactory.makeFakeMain(FakeMainFactory.java:232)
at qilin.core.builder.FakeMainFactory.<init>(FakeMainFactory.java:89)
at qilin.core.PTAScene.<init>(PTAScene.java:57)
at qilin.driver.PTAFactory.createPTA(PTAFactory.java:30)
The line 232 of FakeMainFactory:
addInvoke(
defaultClassLoader,
"<java.lang.ClassLoader: java.lang.Class loadClassInternal(java.lang.String)>",
sv);
My code is as follows:
PTAConfig.v().getPtaConfig().ptaPattern = new PTAPattern("obj");
PTA pta = PTAFactory.createPTA(PTAConfig.v().getPtaConfig().ptaPattern, view, clazz.getName());
When obtaining the view, I have already set DefaultRuntimeAnalysisInputLocation:
private static JavaView getView(String targetPath) {
List<AnalysisInputLocation> inputLocations = new ArrayList<>();
inputLocations.add(new DefaultRuntimeAnalysisInputLocation());
inputLocations.add(
new JavaClassPathAnalysisInputLocation(targetPath, SourceType.Application, Collections.emptyList()));
return new JavaView(inputLocations);
}
Environment:
JDK 21
SootUp version: 2.0.0
How can I resolve this BUG? Why should FakeMainFactory constructed when creating PTAScene?
Your help would be greatly appreciated—this is extremely important to me.
Best wishes!
Version
Latest release (e.g. via Maven)
Relevant log output