stg-tud / MUDetect

Mozilla Public License 2.0
24 stars 8 forks source link

Incorrect AUG Representation #23

Open oneturkmen opened 4 years ago

oneturkmen commented 4 years ago

Hello,

There have been multiple cases where the program representation (AUG) may not be correct or some detail is missing (e.g., type). These are all synthetic examples. I was wondering if there are simply some implementation bugs, or the representations are actually correct?

Generics with Google GSON

Problem: The instance type in a generic type is marked as UNKNOWN, but should be Foo<Integer> or Foo<T> instead.

image

Missing library calls

Problem: There are three gson.fromJson calls inside an "if" block. These are not represented in the AUG.

image

Problem: There are gson.toJson and gson.fromJson calls that are missing.

image

salsolatragus commented 4 years ago

Hi @oneturkmen,

regarding the generic types: I'm unsure. We get the type info from the Eclipse JDT, so I would expect that the JDT is, for some reason or another, unable to resolve the type here. Did you add the respective dependencies to the dependencies classpath when running MUDetect?

Regarding the library call: I think the culprit is that gson is a static variable and all the inputs to the call are literals. As a result, I think we are pruning those calls from the AUG. I seem to remember we did this to filter "cross cutting" logic like logging, which is unrelated to the surrounding objects, but I'm not certain, because this is so long ago... could you see what happens if one of the arguments to fromJson is a parameter to the enclosing method?