You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/12/14 19:07:46 UTC
[jira] [Resolved] (GROOVY-6800) Compilation error when calling
method that has Optional parameter
[ https://issues.apache.org/jira/browse/GROOVY-6800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved GROOVY-6800.
---------------------------------------
Resolution: Fixed
Fix Version/s: 2.3.11
2.4.2
> Compilation error when calling method that has Optional<Closure> parameter
> --------------------------------------------------------------------------
>
> Key: GROOVY-6800
> URL: https://issues.apache.org/jira/browse/GROOVY-6800
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.3.0, 2.4.0-rc-1
> Reporter: Rob Fletcher
> Assignee: Cédric Champeau
> Fix For: 2.4.2, 2.3.11
>
> Attachments: FailingWithClosure.groovy, WorkingWithClosureAndCast.groovy, WorkingWithString.groovy
>
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)