accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Havanki (JIRA)" <>
Subject [jira] [Commented] (ACCUMULO-1627) Add hashcode() and equals() to ConditionalMutation
Date Fri, 27 Sep 2013 18:09:02 GMT


Bill Havanki commented on ACCUMULO-1627:

See [discussion on ACCUMULO-1734|]
for background.

The method {{Mutation.equals(Mutation)}} is problematic for implementing {{equals()}} properly
in a subclass. In short, for some object {{o}} of a subclass type {{SubMutation}}, a call
to {{o.equals(m)}} where {{m}} is a {{Mutation}} will be bound to {{Mutation.equals(Mutation)}},
not {{SubMutation.equals(Object)}}. This is because the {{Mutation}} method has a more specific
argument type, so the compiler prefers it over the proper one in the subclass. This is a problem
for preserving symmetry for {{equals()}} as well as for checking additional fields in the

Mutation m = /* some mutation */;
SubMutation sm = /* some other mutation */;
sm.equals(m); /* <- bound to Mutation.equals(Mutation) */

To remedy this I had thought to protect/rename {{Mutation.equals()}}, relegating it to a utility
comparison method which it appears to be. However, as Keith suspected, this would break ABI
compatibility. Code compiled against the old version would throw {{NoSuchMethodError}}.

Another option is to have each {{Mutation}} subclass also override {{equals(Mutation)}}. It's
messy but it should work.

So, what is the best path according to the development policies for Accumulo? "Fix" the API
at the expense of breaking the ABI, or introduce (modest) warts to work with what already

Thanks all.
> Add hashcode() and equals() to ConditionalMutation
> --------------------------------------------------
>                 Key: ACCUMULO-1627
>                 URL:
>             Project: Accumulo
>          Issue Type: Sub-task
>          Components: client, tserver
>            Reporter: Keith Turner
>            Assignee: Bill Havanki
>              Labels: newbie
>             Fix For: 1.6.0
> ConditionalMutation should define equals() and hashcode() methods that consider the conditions.
  Its parent class defines those methods, so it should.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message