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 2021/04/25 14:43:00 UTC

[jira] [Created] (GROOVY-10057) MissingMethodException for pointer/reference from Class instance to Class method

Eric Milles created GROOVY-10057:
------------------------------------

             Summary: 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


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.3.4#803005)