Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.0, 2.4.0-rc-1
-
None
Description
I'm seeing a strange issue where if I try to call a method with an Optional<Closure> parameter from a type-checked context using Optional.of(someClosure) I get a compilation error. Other type parameters work fine in the same context and weirdly so does Optional.absent().
I've attached 3 scripts that demonstrate the problem.
- FailingWithClosure.groovy shows the problem occurring. I have a method that accepts Optional<Closure> and two statically compiled methods that call it, one with Optional.of(someClosure) and one with Optional.absent().
- WorkingWithString.groovy is the same code but with String type parameters instead of Closure. It works fine.
- WorkingWithClosureAndCast.groovy shows that if I explicitly cast the argument to Optional<Closure> it works.