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

MetaClass.setProperty() tries to access protected fields instead of a given setter Method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.1-beta-1
    • None
    • None

    Description

      The issue was detected with SwingBuilder where
      splitPane(orientation:JSplitPane.VERTICAL_SPLIT)

      produced

      java.lang.reflect.InvocationTargetException
      ...
      at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:160)
      Caused by: java.lang.IllegalAccessException: Class
      groovy.lang.MetaFieldProperty$2 can not access a member of class java
      x.swing.JSplitPane with modifiers "protected"
      at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
      ....

      metaClass.setProperty(jSplitPane, 'orientation', 0)
      accesses the field instead of the setter method.
      (via MetaFieldProperty.setProperty(...))

      it's probably an issue with how the metaclass propertyMap was built in the first place.

      Attachments

        1. AccessToProtectedPublic.zip
          1 kB
          Kim, Pilho
        2. MetaClassImpl.java
          75 kB
          Percy M. Wegmann

        Activity

          People

            blackdrag Jochen Theodorou
            codevise Dierk König
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: