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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.3.2
    • None
    • node2bean

      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.

        Acceptance criteria

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

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD