ctolkmit / checker-framework

Automatically exported from code.google.com/p/checker-framework
0 stars 0 forks source link

Inferring @KeyFor for multiple maps #414

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Jonathan...@gmail.com on 8 Apr 2015 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by jtha...@cs.washington.edu on 18 Apr 2015 at 6:42