soot-oss / soot

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

spark callgraph edge missing: Field.getInt() #1193

Open ddiepo-pjr opened 5 years ago

ddiepo-pjr commented 5 years ago

When using spark to generate a callgraph containing a call to java.awt.AWTKeyStroke.getVKValue(String key) the callgraph is missing the edge to java.lang.reflect.Field.getInt(Object obj) which is expected from the line of code:

keyCode = KeyEvent.class.getField(key).getInt(KeyEvent.class);

This can be seen when creating a callgraph with a progam no bigger than:

public static void main(String[] args)
{
    AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke("alt shift X");
}

or, more directly:

public static void main(String[] args) {
    try {
        int keyCode = KeyEvent.class.getField("MODIFIER_COMMAND").getInt(KeyEvent.class);
        System.out.println("AWT KS: " + keyCode);
    } catch (Exception e) { e.printStackTrace(); }
}

In both of the above cases the callgraph does not contain java.lang.reflect.Field.getInt(Object obj), however it does contain an edge to java.lang.reflect.Field.getField(java.lang.String)

I did search through the other spark-related issues on the project and could not find any others that seemed related to this. Any thoughts as to what may be going on, or some option I should try setting differently? Thanks!

anddann commented 5 years ago

Thanks for reporting the issue... I'll take a look. Did you already try to debug the problem?

ddiepo-pjr commented 5 years ago

Sorry, I have not had availability to dive into the soot/spark code to debug, all I have had time to do is to narrow things down to the code above to reproduce the issue.

miguelvelezmj25 commented 4 years ago

Has this issue been resolved? I am also having an issue with Spark missing some very obvious edges in a different program. I was wondering if a potential fix might also help me fix my issue

asejfia commented 3 years ago

I also have a similar problem. In one method file, I have a call to another method directory, but the Spark callgraph does not have this edge at all. Moreover, it contains additional sporadic edges to a class constructor, an edge which does not exist. Does anyone have any idea where the problem lies?