Skip to content

Conversation

@anelam
Copy link
Contributor

@anelam anelam commented Aug 17, 2017

I generate equals methods, which are required to compare ModifiedVariables in a generic way.

@anelam anelam requested a review from ic0ns August 17, 2017 16:19

ModifiableVariable<?> that = (ModifiableVariable<?>) o;

return modification != null ? modification.equals(that.modification) : that.modification == null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this really work? Since you did not impelemnt equals methods for the modifications. I also think that you do not need to implement Equals Methods. I think its enough if you compare the "getValue"?

@anelam
Copy link
Contributor Author

anelam commented Aug 17, 2017

I removed the equals Method in ModifiableVariable.

@anelam
Copy link
Contributor Author

anelam commented Aug 17, 2017

Oh wait my application is broken now ...

@anelam
Copy link
Contributor Author

anelam commented Aug 17, 2017

Everything should be fine now. There was a equality check of the superclass in every equals Method.

@anelam anelam changed the title Generate equals and hashCode Methods Generate equals, hashCode and toString Methods Aug 17, 2017
@ic0ns
Copy link
Contributor

ic0ns commented Aug 18, 2017

I am still unsure if this is what you want. You are currently checking the OriginalValue, i guess you want getValue?

@anelam
Copy link
Contributor Author

anelam commented Aug 18, 2017

With my implementation both is possible, but you are right, its more logical to use getValue.

@ic0ns ic0ns merged commit 360af1e into master Aug 29, 2017
@ic0ns ic0ns deleted the equals-hashcode branch September 5, 2017 15:26
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

Successfully merging this pull request may close these issues.

3 participants