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

Referencing a method closures should work with GStrings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1-beta-1
    • None
    • None

    Description

      foo.&"$bar" doesn't work as expected

      We should be able to define method closures with gstring identifiers.

      groovy> class MCTest {
      groovy> void testMethod1()

      { println "m1" }

      groovy> void testMethod2()

      { println "m2" }

      groovy> }
      groovy> mctest = new MCTest()
      groovy> m = mctest.class.methods.name.grep(~/^test.*$/).collect

      { mctest.&"$it" }

      groovy> m.each

      { it() }

      groovy> go
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, CommandLine.groovy:
      6: Unexpected node type: DYNAMIC_MEMBER found when expecting type: an identifier at line: 6 column:
      67. File: CommandLine.groovy @ line 6, column 67.
      1 error

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: