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

Groovyc - Synthetic Metadata (Java 1.5)

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.1-rc-3
    • class generator
    • None

    Description

      This is just a throwaway idea related to named and optional parameters.

      Groovyc could emit synthetic metadata for the names of parameters.
      This would provide support for named parameters to methods, or just improved IDE functionality.

      @parameter-names (

      {"what", "target"}

      )
      doItNow(what, target {
      ....
      }

      For methods with default parameters, we could also mark which methods are synthetic and a preview of what the value is. This would allow a smart enough IDE to fold these methods back into a single method and show the default values in the signature.

      doSomething(a, b = 'defB', c = 'defC') {
      }

      The above groovy method would create multiple methods with synthetic metadata.

      @parameter-names (

      {"a", "b", "c"}

      )
      Object doSomething(Object a, Object b, Object c) {
      ...
      }

      @parameter-names (

      {"a"}

      )
      @default-parameters {
      concrete-method = "Object doSomething(Object a, Object b, Object c)",
      defaults (

      {"defB", "defC"}

      )
      }
      Object doSomething(Object a) {
      // synthetic method
      }

      Attachments

        Activity

          People

            alexpopescu Alexandru Popescu
            yuri Yuri Schimke
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: