The purpose of HashCode2/Equals2 interfaces.
Hello,
due to -XhashCode/-Xequals our JAXB-generated classes implement HashCode2 and Equals2 interfaces and this makes our artifacts transitively dependant on jaxb2-basics-runtime. Is it really necessary? I wonder what is the point of decorating classes with those two interfaces as it seems both are used only internally - at hashCode and equals methods. Would you mind explaining it to me?
Thank you in advance,
Karol.
Hi Karol-
They generate classes that use a shared implementation for doing hashCode and equals functions. If you want dependency free generation, use the settings below. They generate dependency-free equals and hashcode methods on the generated classes.
simpleEquals: https://github.com/highsource/jaxb2-basics/wiki/JAXB2-SimpleEquals-Plugin simpleHashCode: https://github.com/highsource/jaxb2-basics/wiki/JAXB2-SimpleHashCode-Plugin