users@jaxb.java.net

JAXB 6u3 -> 6u4 6u5 setter/getter weirdness

From: davis <davisford_at_gmail.com>
Date: Fri, 11 Apr 2008 12:11:31 -0700 (PDT)

Hi, we had been happily using JAXB annotations to marshall/unmarshall our
object model to/from XML. That was, until I tried to upgrade the JDK from
6u3 to either 6u4 or 6u5.

We annotate the getters something like this:

    @XmlElementWrapper(name = "DictionaryAssociations")
    @XmlElementRef(name = "DictionaryAssociation", type =
DictionaryAssociationImpl.class)
    @Override
    public Collection<DictionaryAssociation> getAssociations() {

        return associations;
    }

but we have other methods that can look up, for instance an association by
name:

   public DictionaryAssociation getAssociation(String name) {
        return associationNameMap.get(name);
   }

The 6u3 and prior JAXB always used the setters, so that is where we had
logic to initialize this name index:

   public void setAssociations(Collection<DictionaryAssociation> col) {
       // initialize name-index here
   }

Now this code does not appear to run when we unmarshall the xml -- which
means the indices never get initialized. I'm guessing JAXB initializes via
field-reflection now instead of using the corresponding setter. Does anyone
know why -- and is there a simple fix (instead of me having to re-write this
code to initialize it somewhere else) ??

Thx in advance,
Davis
-- 
View this message in context: http://www.nabble.com/JAXB-6u3--%3E-6u4-6u5-setter-getter-weirdness-tp16628215p16628215.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.