Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable @PolyAll to work for the @KeyFor hierarchy #429

Closed
GoogleCodeExporter opened this issue Jul 3, 2015 · 2 comments
Closed

Enable @PolyAll to work for the @KeyFor hierarchy #429

GoogleCodeExporter opened this issue Jul 3, 2015 · 2 comments
Labels
Milestone

Comments

@GoogleCodeExporter
Copy link

Given the following code, it should be possible to remove the @SuppressWarnings 
and instead annotate nounSubset as @PolyAll in its argument and return value, 
so that @PolyAll can capture the need to annotate them with @KeyFor("dict") at 
the call site.
Note: Remove the link to this issue from the manual once this issue is fixed.



Map<String, String> dict;   // English dictionary. Maps words to their 
definitions.

// Method nounSubset's declaration uses no @KeyFor annotations
// because in addition to being used by the dictionary feature,
// it is also used by a spell checker that only stores sets of words
// and does not use the notions of dictionaries, maps, or keys.
public Set<String> nounSubset(Set<String> words) { ... }

void outputAllNounDefinitions() {
    @SuppressWarnings("keyfor") // argument elements are @KeyFor("dict"), so result elements are too
    Set<@KeyFor("dict") String> nounSet = nounSubset(dict.keySet());

    for (@KeyFor("dict") String noun : nounSet) {
      String definition = dict.get(noun);
      System.out.println(noun + ": " + definition);
    }
}

Original issue reported on code.google.com by jtha...@cs.washington.edu on 16 Apr 2015 at 7:47

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision 8c5399df4f7d.

Original comment by mer...@cs.washington.edu on 3 Jul 2015 at 12:02

  • Changed state: Fixed

@mernst mernst modified the milestone: Medium Jul 10, 2015
@smillst
Copy link
Member

smillst commented Aug 16, 2016

Fixed via d8f11c5

wmdietl added a commit to wmdietl/checker-framework that referenced this issue Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants