Details

    • Type: Wish Wish
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.3, 1.8-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      Describe a class

      class Foo {
        static def getBar(){}
        static def setBar(def bar){}
      }
      

      and a script

      import static Foo.bar
      
      print bar
      print getBar()
      

      Now 'print getBar()' throws MissingMethodException.
      IMHO 'getBar()' should be resolved to Foo.getBar() without explicit import

      The same thing is with setters and aliased imports.

      import static Foo.bar
      
      setBar(2)
      
       
      import static Foo.bar as baz
      
      setBaz(2)
      print getBaz()
      
      import static Foo.getBar
      
      print bar
      
      import static Foo.setBar
      
      bar = 2
      

        Issue Links

          Activity

          Maximilian Michels created issue -
          Hide
          Paul King added a comment -

          Initial support for statically importing properties is now in trunk and the 1_7_X branch. It still needs some finessing when public fields and property accessors are used in combo but I wanted to give others the chance to test usage for normal properties.

          Show
          Paul King added a comment - Initial support for statically importing properties is now in trunk and the 1_7_X branch. It still needs some finessing when public fields and property accessors are used in combo but I wanted to give others the chance to test usage for normal properties.
          Paul King made changes -
          Field Original Value New Value
          Link This issue is related to GROOVY-4145 [ GROOVY-4145 ]
          Paul King made changes -
          Link This issue depends upon GROOVY-3945 [ GROOVY-3945 ]
          Paul King made changes -
          Link This issue is related to GROOVY-3945 [ GROOVY-3945 ]
          Paul King made changes -
          Link This issue depends upon GROOVY-3945 [ GROOVY-3945 ]
          Paul King made changes -
          Assignee Paul King [ paulk_asert ]
          Hide
          Paul King added a comment -

          Now working for public fields as well.

          Show
          Paul King added a comment - Now working for public fields as well.
          Paul King made changes -
          Fix Version/s 1.8-beta-1 [ 16013 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 1.7.3 [ 16356 ]
          Hide
          Maxim Medvedev added a comment -

          It doesn't work for boolean properties and isFoo() getters

          Show
          Maxim Medvedev added a comment - It doesn't work for boolean properties and isFoo() getters
          Hide
          Guillaume Delcroix added a comment -

          Perhaps it's also related to GROOVY-4206 ?

          Show
          Guillaume Delcroix added a comment - Perhaps it's also related to GROOVY-4206 ?
          Hide
          Maxim Medvedev added a comment -

          I mean isBar() is not resolved in static import context.

          class Foo {
            static boolean bar = true
          }
          
          import static Foo.bar
          
          print isBar() //MissingMethodException is thrown
          
          Show
          Maxim Medvedev added a comment - I mean isBar() is not resolved in static import context. class Foo { static boolean bar = true } import static Foo.bar print isBar() //MissingMethodException is thrown
          Hide
          Maxim Medvedev added a comment -

          I've used Groovy 1.7.3

          Show
          Maxim Medvedev added a comment - I've used Groovy 1.7.3
          Hide
          Guillaume Delcroix added a comment -

          When you say you're using Groovy 1.7.3, you mean a snapshot we publish, or built yourself? (1.7.3 hasn't yet been released! or are you coming from the future?

          Show
          Guillaume Delcroix added a comment - When you say you're using Groovy 1.7.3, you mean a snapshot we publish, or built yourself? (1.7.3 hasn't yet been released! or are you coming from the future?
          Hide
          Maxim Medvedev added a comment -

          I'm using published snapshot but nevertheless I'm from future

          Show
          Maxim Medvedev added a comment - I'm using published snapshot but nevertheless I'm from future
          Hide
          Paul King added a comment -

          Yes, the solution didn't cover that case previously but has now been enhanced to cover that case as well. If you could check with the latest snapshot jar once bamboo has had time to do its thing, that would be great.

          Show
          Paul King added a comment - Yes, the solution didn't cover that case previously but has now been enhanced to cover that case as well. If you could check with the latest snapshot jar once bamboo has had time to do its thing, that would be great.
          Paul King made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Mark Thomas made changes -
          Workflow jira [ 12733097 ] Default workflow, editable Closed status [ 12744866 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12970722 ] Default workflow, editable Closed status [ 12978506 ]
          Mark Thomas made changes -
          Assignee paulk_asert [ paulk_asert ] Paul King [ paulk ]
          Mark Thomas made changes -
          Reporter Maximilian Michels [ mxm ] Maxim Medvedev [ mxm-groovy ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          5d 18h 4m 1 Paul King 13/Apr/10 00:46
          Resolved Resolved Closed Closed
          71d 14h 58m 1 Paul King 23/Jun/10 15:45

            People

            • Assignee:
              Paul King
              Reporter:
              Maxim Medvedev
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development