I have following code
Map map = new HashMap();
String key = "key";
AppPreferences value = new AppPreferences();
map.put(key, value ); // line 1
map.put(value, value ); // line 2
map.put("key", value ); // line 3
map.put("key", new AppPreferences()); // line 4
I am using following 2 templates
$map$.put($key$, $value$) where map is any subtype of java.util.Map, key is String, value is any subtype of com.abc.AppPreferences
$map$.put($key$, $value$) where map is any subtype of java.util.Map, key any subtype of Object, value is any subtype of com.abc.AppPreferences
I get the following hits:
template1 - matches found - line 1
template 2 - matches found - none
For template 1, I was expecting line 1, 3 and line 4 to match since in line 1,3,4 key is string and value is AppPreferences.
For template 2, I was expecting all 4 lines to match since in all these lines, key is object and value is AppPreferences.
What am I missing? HELP!!!!