runtimeverification / javamop

Runtime verification system for Java, using AspectJ for instrumentation.
http://fsl.cs.illinois.edu/javamop
MIT License
45 stars 37 forks source link

RV-Monitor check's String parameters by reference not by value #252

Open iraklitchedia opened 6 years ago

iraklitchedia commented 6 years ago

Hi.

I am using javaMOP to generate parametric RV-Monitor, that will have String parameters. I have already generated monitor program, but the problem is that, whenever new event happens and the program checks whether the Monitor object for this specific parameter already exists or not, the equality check is done by reference not by value. So, new Monitor is created even if the Monitor for the String parameter with same value already exists. What I need to happen is that , if the Monitor object with this specific String value already exists, then use this monitor and not create a new one even if String object reference is different.

Is there any way to make javaMOP generate the program, that will check String parameters by value not by reference, when it is checking whether Monitor object for this specific parameters already exists or not? (Use .equals() instead of "==").

Example:

1screenshot-from-2018-09-14-12-04-34

This is the screenshot of generated RV-Monitor code. It's shows the part of a function which is called after event happens. First, it checks for the cache hit, and then if parameters are not same in the cache it is looking inside WebShop_name_price_Map using function getNodeEquivalent(). Both cache check and Search in the map is done by reference.

Thanks.