Fix InternalAttribute.equals

Motivation:

InternalAttribute doesn't extend Attribute, but its equals only returns true when it compares with an Attribute. So it will return false when comparing with itself.

Modifications:

Make sure InternalAttribute return false for non InternalAttribute objects.

Result:

InternalAttribute's equals works correctly.
This commit is contained in:
Xiaoyan Lin 2016-01-10 14:48:09 -08:00 committed by Norman Maurer
parent 6f8618889a
commit 1edf9eb94c

View File

@ -79,10 +79,10 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (!(o instanceof Attribute)) { if (!(o instanceof InternalAttribute)) {
return false; return false;
} }
Attribute attribute = (Attribute) o; InternalAttribute attribute = (InternalAttribute) o;
return getName().equalsIgnoreCase(attribute.getName()); return getName().equalsIgnoreCase(attribute.getName());
} }