Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10057

MissingMethodException for pointer/reference from Class instance to Class method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-alpha-3
    • 4.0.0-beta-1
    • None
    • None

    Description

      Consider the following:

      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
      

      The reference and pointer groups fail while the lambda and closure groups succeed. This is excerpted from GROOVY-10053 testing without SC.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: