Skip to content

Instantly share code, notes, and snippets.

@jeffscottbrown
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save jeffscottbrown/652af416d83cd8a039f5 to your computer and use it in GitHub Desktop.

Select an option

Save jeffscottbrown/652af416d83cd8a039f5 to your computer and use it in GitHub Desktop.
package demo
import groovy.transform.CompileStatic
@CompileStatic
class Demo {
void doit() {
def c = {
Map<String, String> data = [:]
Map<String, Set<String>> otherData = [:]
// GGTS marks the call to data.each with the following error...
// Groovy:[Static type checking] - Cannot call <K,V> java.util.LinkedHashMap <java.lang.String, java.lang.String>#each(groovy.lang.Closure <java.lang.String>)
// with arguments [groovy.lang.Closure <java.util.Set>]
data.each { String k, String v ->
// commenting out the following line allows the code to compile...
def foo = otherData.get(k)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment