You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:35:00 UTC
[jira] [Closed] (GROOVY-10057) MissingMethodException for pointer/reference from Class instance to Class method
[ https://issues.apache.org/jira/browse/GROOVY-10057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10057.
------------------------------
> MissingMethodException for pointer/reference from Class instance to Class method
> --------------------------------------------------------------------------------
>
> Key: GROOVY-10057
> URL: https://issues.apache.org/jira/browse/GROOVY-10057
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.0-alpha-3
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-1
>
>
> Consider the following:
> {code:groovy}
> Class c = Integer
> Predicate p
> p = c::isInstance
> assert p.test(null) == false
> assert p.test('xx') == false
> assert p.test(1234) == true
> p = c.&isInstance
> assert p.test(null) == false
> assert p.test('xx') == false
> assert p.test(1234) == true
> p = o -> c.isInstance(o)
> assert p.test(null) == false
> assert p.test('xx') == false
> assert p.test(1234) == true
> p = { c.isInstance(it) }
> assert p.test(null) == false
> assert p.test('xx') == false
> assert p.test(1234) == true
> {code}
> The reference and pointer groups fail while the lambda and closure groups succeed. This is excerpted from GROOVY-10053 testing without SC.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)