konveyor / konveyor/dgi-code-analyzer
Fixes to let us to use ClassHierarchyFactory.makeWithPhantom (changes in Phantom, ByecodeClass, etc)
- Dominant language
- Java
- Stars
- 0
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Currently, when running jpet app with all the packages and no extra libs as well as running petclinic, we get a `NoSuperclassFoundException` failure (https://github.ibm.com/rkrsn/WALA-1.5.10/blob/5bf1c8dd55553ceef151f66fc88fac5f5290a358/com.ibm.wala.core/src/main/java/com/ibm/wala/classLoader/BytecodeClass.java#L280). Btw, I am using 01CFA Wala Algorithm.
One solution was, instead of the failure, return the object:
```
superClass = loader.lookupClass(TypeReference.JavaLangObject.getName());
```
Ideally, we would include a try-catch in the places that call the `BytecodeClass`, but there are so many places that for now the alternative was include the return of Object directly in the `BytecodeClass`, instead of the failure.
However, that solution alone creates a `java.lang.ArrayIndexOutOfBoundsException` in ` recv = v[0].getConcreteType();`
https://github.ibm.com/rkrsn/WALA-1.5.10/blob/5bf1c8dd55553ceef151f66fc88fac5f5290a358/com.ibm.wala.core/src/main/java/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java#L2079
That was solved by adding a verification
```
if (site.isDispatch()) {
if(v != null && v.length >0 && v[0] != null){
recv = v[0].getConcreteType();
}
else {
return;
}
}
```
Btw, this seems the solution for the issue https://github.com/konveyor/dgi-code-analyzer/issues/7 too.
And then, another NullPointerException was observed in `indices` variable in https://github.ibm.com/rkrsn/WALA-1.5.10/blob/5bf1c8dd55553ceef151f66fc88fac5f5290a358/com.ibm.wala.core/src/main/java/com/ibm/wala/ipa/slicer/SDG.java#L522
```
for (IntIterator ii = indices.intIterator(); ii.hasNext(); ) { ... }
```
that was also fixed with a simple check:
```
if (indices != null){
for (IntIterator ii = indices.intIterator(); ii.hasNext(); ) {
int i = ii.next();
Statement s = new NormalReturnCaller(caller, i);
addNode(s);
result.add(s);
}
}
```
Finally, a NullPointerException was caught in https://github.com/rahlk/dgi-code-analyzer/blob/62bb2f0e9fc96355edfac591488845ea33b38083/src/main/java/org/konveyor/dgi/utils/Graph2JSON.java#L79, which was fixed by this verification:
```
&& dfsStart.get(p) != null && dfsStart.get(s) != null
```
which is also the strategy included in https://github.com/konveyor/dgi-code-analyzer/issues/13 (so, it still have issues with RTA algorithm).
With all those changes, I finally am able to run jpet successfully using 01CFA Wala algorithm. For petclinic I got an empty sdg graph, which makes me wonder what more can be done.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.