groovy
  1. groovy
  2. GROOVY-4812

Problem Parsing Expression With 1.8.0

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.0
    • Fix Version/s: 1.8.4, 2.0-beta-1
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The following works with 1.7.x but fails with 1.8.0

      Demo.groovy
      class Demo  {
         
         void doit() {
             execute new Runnable(){
                 void run() {
                     println 'hello'
                 }
             }
         }
         
         void execute(arg) {
             arg.run()
         }
         
         static void main(args) {
             new Demo().doit()
         }
      }
      

      The code fails with a MissingPropertyException:

      $ groovy Demo
      Caught: groovy.lang.MissingPropertyException: No such property: execute for class: Demo
              at Demo.doit(Demo.groovy:4)
              at Demo.main(Demo.groovy:16)
      

      If I put parens around the argument to the execute method, then it appears to work:

      Demo.groovy
      class Demo  {
         
         void doit() {
             execute(new Runnable(){
                 void run() {
                     println 'hello'
                 }
             })
         }
         
         void execute(arg) {
             arg.run()
         }
         
         static void main(args) {
             new Demo().doit()
         }
      }
      

        Activity

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Jeff Scott Brown
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: