After a put operation, the argument's type should be inferred to have type
@KeyFor(...).
This works when the variable's type has no @KeyFor annotation, as in method
simple() below.
However, it does not work when the variable's type already has a @KeyFor
annotation, as in method semiSimple() below.
To reproduce the problem, see the attached test case.
void simple(String s) {
Map<String,Integer> mymap = new HashMap<String,Integer>();
mymap.put(s, 1);
@KeyFor("mymap") String s2 = s;
}
Map<String,Integer> someField = new HashMap<String,Integer>();
void semiSimple(/*@KeyFor("this.someField")*/ String s) {
Map<String,Integer> mymap = new HashMap<String,Integer>();
mymap.put(s, 1);
/*@KeyFor({"this.someField","mymap"})*/ String s2 = s;
}
Original issue reported on code.google.com by michael.ernst@gmail.com on 19 Mar 2015 at 2:40
Original issue reported on code.google.com by
michael.ernst@gmail.com
on 19 Mar 2015 at 2:40Attachments: