XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.2
    • None
    • groovy-runtime
    • None

    Description

      Consider the following snippet:

      class A { private int a }
      def a = new A()
      a.@a=1 
      
      class B extends A {}
      def b = new B()
      b.@a=1 // groovy.lang.MissingFieldException: No such field: a for class: B
      

      I can understand why it happens, yet is there a reason for the MOP not to try a little harder and resolve to a field named 'a' in the closest parent?

      Alternatively, would be nice to allow us to specify the type to be used by using casting:

      ((A)b).@a=1
      

      See also: http://groovy.329449.n5.nabble.com/Private-field-not-found-in-inherited-classes-td5711338.html

      Attachments

        Activity

          People

            Unassigned Unassigned
            ddimitrov Dimitar Dimitrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: