0

Under Java 1.7 it didn't matter what instance was returned from the getter, but under 1.8 this matters. Under 1.8 you have to assign the collection passed in to your class variable and you have to return your class variable, you can't return a new Collection containing the elements. I was trying to search for any documentation on this change but I can't find anything.

It seems that the JAXB implementation is very fragile. There is no documentation in the JAXB chanelog that would indicate this as being a fundamental change to the library: https://jaxb.java.net/nonav/2.2.5-4/docs/release-documentation.html#a-2-2-5u4

JDK JAXB version info: https://jaxb.java.net/guide/Which_JAXB_RI_is_included_in_which_JDK_.html

What is the upgrade path for JAXB? Is there even one from 1.7 to 1.8?

Is JAXB even worth using if it's this fragile from JDK to JDK?

This question is more about upgrading JAXB as it seems it's really not backwards compatible and there is no documentation that I could find that says: "WARNING! not compatible with previous JAXB version if you use collections make sure you make the following changes."

Sergey Ponomarev
  • 2,947
  • 1
  • 33
  • 43
Coder
  • 1,375
  • 2
  • 20
  • 45
  • Can you post an example I can run of your JAXB issue that works in JDK 1.7 but not on JDK 1.8? – bdoughan May 15 '14 at 12:06
  • http://stackoverflow.com/questions/23664516/jaxb-configuration-was-broken-by-upgrading-from-jdk-1-7-to-jdk-1-8-u05-for-colle – Coder May 15 '14 at 12:34
  • Upon doing more testing i discovered that JAXB doesn't call my setter method for collections anymore even though the setter method is annotated with JAXBAnnotations. This used to work. It seems like it now uses the getter and modifies the values in the list directly. This is very problematic for the backwards incompatibility, exposing an internal collection to be modified by the outside world freely (bad practice) and I also have custom code I need to do when the list is changed which I handled in the setter. If the setter is not called this is problematic. – Coder May 15 '14 at 12:37
  • Again, this question is more about upgrade procedure for JAXB so I don't think it should be marked as a duplicate. – Coder May 15 '14 at 12:41
  • Ultimately it's not an upgrade issue. I will help you solve the issue on the other thread. – bdoughan May 15 '14 at 12:43
  • thanks. I updated that question with more information. In this question I wanted to know more about how I would know this ahead of time in the future that I have to rework all of my configurations. I didn't see a warning anywhere or an easy to understand backwards incompatibility note about JAXB on Java's site or JAXB webpage. I tried for a while reading though the changelogs and there is nothing obvious there. – Coder May 15 '14 at 12:45

0 Answers0