You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
jtha...@cs.washington.edu
on 16 Apr 2015 at 7:47The text was updated successfully, but these errors were encountered: