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

Inconsistency with callable properties in static context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.6
    • 3.0.7, 4.0.0-alpha-2
    • None
    • None

    Description

      playground.groovy
      class C {
          def call() {
              42
          }
      }
      
      class Container {
          static final staticC   = new C()
          def          instanceC = new C()
      }
      
      assert Container.staticC() == 42 // works fine
      def container = new Container()
      assert container.staticC() == 42 // MissingMethodException
      assert container.instanceC() == 42 // MissingMethodException
      

      I'd expect the invocations to fail or to work in both static and instance contexts.

      Attachments

        Activity

          People

            emilles Eric Milles
            daniilo Daniil Ovchinnikov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h