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

Incorrect modifers on setter for volatile property with @Bindable/@Vetoable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.8
    • None
    • None

    Description

      As part of GROOVY-3726 we fixed getter/setter method modifiers for volatile (or transient) properties. The @Bindable and @Vetoable transforms however generate their own setters and bypass that fix.

      Here is a script to reproduce the problem:

      import static java.lang.reflect.Modifier.toString
      import groovy.beans.Bindable
      
      class Foo {
        volatile Date now
      }
      
      @Bindable class Bar {
        volatile Date then
      }
      
      void pretty(int mod) { println "${mod.toString().padRight(10)}" + toString(mod) }
      
      pretty(Foo.getMethod('getNow').modifiers)
      pretty(Foo.getMethod('setNow', Date).modifiers)
      pretty(Bar.getMethod('getThen').modifiers)
      pretty(Bar.getMethod('setThen', Date).modifiers)
      

      which currently produces:

      1         public
      1         public
      1         public
      65        public volatile
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: