Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The purpose of HashCode2/Equals2 interfaces. #121

Open
ksiczek opened this issue Oct 22, 2020 · 1 comment
Open

The purpose of HashCode2/Equals2 interfaces. #121

ksiczek opened this issue Oct 22, 2020 · 1 comment

Comments

@ksiczek
Copy link

ksiczek commented Oct 22, 2020

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.

@mattrpav
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants