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

Allow calling quoted methods and GString interpolated methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.0-RC-1
    • parser-antlr2
    • None

    Description

      Currently (as of jsr-03), we can call method with quoted identifiers:

      obj."baz:foo-bar"()

      This is particularly handy for builders to output / create any node we want without having to comply to Java's identifier naming rules.

      However, we can't (yet) call

      "baz:foo-bar"()

      without prefixing the method by this (if we're inside the class), or with the object prefix (when outside).

      Moreover, we should also be able to use GStrings for those quoted method names, so that:

      def methodName = "someMethod"
      assert "$methodName"(1, 2, 3) == someMethod(1, 2, 3)

      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: