Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5864

Inconsistent getter/setter types aren't working with Node2Bean under Java 8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3.2
    • Component/s: node2bean
    • Labels:

      Description

      Java 8 has a slightly different JavaBeans implementation, leading to the propertyType of a java.beans.PropertyDescriptor being null when a getter/setter don't take/return the exact same type AND that property is declared on a parent class of the one we're introspecting. Don't ask me why.
      When introspecting classes with org.apache.commons.beanutils.PropertyUtils#getPropertyDescriptors, which in turn uses java.beans.Introspector and returns arrays of java.beans.PropertyDescriptor, if getter and setter use different type (e.g setter takes a narrower type), and we're introspecting a subclass of the class where the property in question is declared:

      • With Java 6: only the propertyType and readMethod are seen; node2bean won't be able to set the property without a writeMethod.
        • if there is an add method, then that's used instead of the writeMethod and all is well.
      • With Java 8: only the readMethod and writeMethod are seen, but propertyType isn't.
        • if there is an add method, then that's used instead of the writeMethod and all is well.

        Checklists

        Acceptance criteria

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                gjoseph Magnolia International
                Reporter:
                gjoseph Magnolia International
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Checklists

                    Bug DoR
                    DoD