Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.6
-
None
Description
@CompileStatic class Test<T> { def map(Closure<T> mapper) { } def failing(Closure<Boolean> predicate) { map { T it -> return predicate(it) ? it : null } } def passing(Closure<Boolean> predicate) { map { T it -> return predicate(it) ? it : (T) null } } def failingWithExplicitCast(Closure<Boolean> predicate) { Closure<T> c = { T it -> return predicate(it) ? it : null } map(c) } }
In the last case, I would expect the compiler to obey the forced cast even at the risk of producing class-cast exception at runtime.