You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/10/25 19:50:00 UTC
[jira] [Commented] (GROOVY-10792) Declared generic parameter on method not transferred to Closure
[ https://issues.apache.org/jira/browse/GROOVY-10792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17624008#comment-17624008 ]
Eric Milles commented on GROOVY-10792:
--------------------------------------
Even {{Closure<Boolean>}} fails:
{code:groovy}
void proc(Closure<Boolean> c) {
boolean result = c().booleanValue()
assert !result
}
def list = []
proc {
list
}
{code}
"No signature of method: java.util.ArrayList.booleanValue() is applicable ..."
> Declared generic parameter on method not transferred to Closure
> ---------------------------------------------------------------
>
> Key: GROOVY-10792
> URL: https://issues.apache.org/jira/browse/GROOVY-10792
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 4.0.6
> Reporter: Christopher Smith
> Priority: Minor
>
> This is probably a duplicate, but I'm not sure which of.
> I'm using Awaitility's {{until(Callable<Boolean>)}} and passing it a closure:
> {code:groovy}
> List<String> buffer = []
> ...
> await().until { buffer }
> {code}
> Expected behavior: {{buffer}} is coerced to a boolean using Groovy truth.
> Actual behavior:
> {code}
> java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.Boolean
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)