Details
Description
@CompileStatic(TypeCheckingMode.SKIP)
static Closure memoize(MemcacheService memcache, Closure closure) {
return new Closure(closure.owner) {
Object call(Object[] args) {
// a closure call is identified by its hashcode and its call argument values
def key = [
closure: closure.hashCode(),
arguments: args.toList()
]
// search for a result for such a call in memcache
def result = memcache.get(key)
if (result != null) {
// a previous invocation exists
return result
} else {
// no previous invocation, so calling the closure and caching the result
result = closure(* args)
put(memcache, key, result, Expiration.byDeltaSeconds(60), SetPolicy.SET_ALWAYS)
return result
}
}
}
}
results in
/glaforge-gaelyk/core/src/main/groovyx/gaelyk/GaelykCategory.groovy: 1687: [Static type checking] - The spread operator cannot be used as argument of method or closure calls with static type checking because the number of arguments cannot be determined at compile time @ line 1687, column 38. result = closure(* args) ^ 1 error
yet it has been annotated with
@CompileStatic(TypeCheckingMode.SKIP)
https://github.com/glaforge/gaelyk/tree/groovy2