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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.8
    • Component/s: None
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: