You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "chunlinyao (Jira)" <ji...@apache.org> on 2021/05/12 13:46:00 UTC
[jira] [Created] (GROOVY-10083) ComposedClosure thrown
ClassCastException when owner is not Closure
chunlinyao created GROOVY-10083:
-----------------------------------
Summary: ComposedClosure thrown ClassCastException when owner is not Closure
Key: GROOVY-10083
URL: https://issues.apache.org/jira/browse/GROOVY-10083
Project: Groovy
Issue Type: Bug
Components: groovy-runtime
Affects Versions: 2.5.14
Reporter: chunlinyao
ComposedClosure consider owner is an instance of Closure, But If we changed owner property to other class, setResolveStrategy will thrown ClassCastException.
This is a simple test
{code:java}
a = {println "aa"}
b = {println "bb"} >> a
c = 1
d = b.rehydrate(c,c,c)
d.setResolveStrategy(Closure.DELEGATE_FIRST)
// ERROR java.lang.ClassCastException:
// java.lang.Integer cannot be cast to groovy.lang.Closure
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)