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

Traits dont allow $ in identifiers where normal classes do

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0, 2.4.3
    • 2.4.8
    • None

    Description

      looks like traits are stricter than the "normal" groovy when an identifier happens to contain the dollar sign:

      252 /tmp> <q.groovy
      trait Test {
       static foo_ok() { println 'trait non-$ OK' }
       static foo$oops() { println 'trait $ OK' }
      }
      class Foo implements Test {
       static foo$ok() { println 'class $ OK' }
      }
      Foo.foo$ok()
      Foo.foo_ok()
      Foo.foo$oops()
      253 /tmp> groovy q
      class $ OK
      trait non-$ OK
      Caught: groovy.lang.MissingMethodException: No signature of method: static Foo.foo$oops() is applicable for argument types: () values: []
      Possible solutions: foo$ok(), foo_ok()
      ...
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              oc OC
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: