jaxb2-basics icon indicating copy to clipboard operation
jaxb2-basics copied to clipboard

The purpose of HashCode2/Equals2 interfaces.

Open ksiczek opened this issue 5 years ago • 1 comments

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.

ksiczek avatar Oct 22 '20 16:10 ksiczek

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

mattrpav avatar Jan 20 '21 15:01 mattrpav