Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;

Expand Down Expand Up @@ -293,19 +294,17 @@ public static class TopologyItem {
}

@Override
public boolean equals(Object o) {
if (this == o)
public boolean equals(Object obj) {
if (this == obj) {
return true;
if (o == null || getClass() != o.getClass())
}
if (!(obj instanceof TopologyItem other)) {
return false;
}

TopologyItem item = (TopologyItem) o;

if (nodeID != null ? !nodeID.equals(item.nodeID) : item.nodeID != null)
return false;
if (primary != null ? !primary.equals(item.primary) : item.primary != null)
return false;
return backup != null ? backup.equals(item.backup) : item.backup == null;
return Objects.equals(nodeID, other.nodeID) &&
Objects.equals(primary, other.primary) &&
Objects.equals(backup, other.backup);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ public int hashCode() {
}

@Override
public boolean equals(final Object other) {
if (other == this) {
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}

if (other instanceof ObjLongPair == false) {
if (!(obj instanceof ObjLongPair other)) {
return false;
}

ObjLongPair<A> pother = (ObjLongPair<A>) other;

return (Objects.equals(pother.a, a)) && (pother.b == b);
return Objects.equals(other.a, a) &&
other.b == b;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.activemq.artemis.api.core;

import java.io.Serializable;
import java.util.Objects;

/**
* A Pair is a holder for 2 objects.
Expand Down Expand Up @@ -53,19 +54,16 @@ public int hashCode() {
}

@Override
public boolean equals(final Object other) {
if (other == this) {
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}

if (other instanceof Pair == false) {
if (!(obj instanceof Pair<?, ?> other)) {
return false;
}

Pair<A, B> pother = (Pair<A, B>) other;

return (pother.a == null ? a == null : pother.a.equals(a)) && (pother.b == null ? b == null : pother.b.equals(b));

return Objects.equals(other.a, a) &&
Objects.equals(other.b, b);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,80 +847,46 @@ public static QueueConfiguration fromJSON(String jsonString) {
}

@Override
public boolean equals(Object o) {
if (this == o)
public boolean equals(Object obj) {
if (this == obj) {
return true;
if (o == null || getClass() != o.getClass())
return false;

QueueConfiguration that = (QueueConfiguration) o;

if (!Objects.equals(id, that.id))
return false;
if (!Objects.equals(name, that.name))
return false;
if (!Objects.equals(address, that.address))
return false;
if (!Objects.equals(routingType, that.routingType))
return false;
if (!Objects.equals(filterString, that.filterString))
return false;
if (!Objects.equals(durable, that.durable))
return false;
if (!Objects.equals(user, that.user))
return false;
if (!Objects.equals(maxConsumers, that.maxConsumers))
return false;
if (!Objects.equals(exclusive, that.exclusive))
return false;
if (!Objects.equals(groupRebalance, that.groupRebalance))
return false;
if (!Objects.equals(groupRebalancePauseDispatch, that.groupRebalancePauseDispatch))
return false;
if (!Objects.equals(groupBuckets, that.groupBuckets))
return false;
if (!Objects.equals(groupFirstKey, that.groupFirstKey))
return false;
if (!Objects.equals(lastValue, that.lastValue))
return false;
if (!Objects.equals(lastValueKey, that.lastValueKey))
return false;
if (!Objects.equals(nonDestructive, that.nonDestructive))
return false;
if (!Objects.equals(purgeOnNoConsumers, that.purgeOnNoConsumers))
return false;
if (!Objects.equals(enabled, that.enabled))
return false;
if (!Objects.equals(consumersBeforeDispatch, that.consumersBeforeDispatch))
return false;
if (!Objects.equals(delayBeforeDispatch, that.delayBeforeDispatch))
return false;
if (!Objects.equals(consumerPriority, that.consumerPriority))
return false;
if (!Objects.equals(autoDelete, that.autoDelete))
return false;
if (!Objects.equals(autoDeleteDelay, that.autoDeleteDelay))
return false;
if (!Objects.equals(autoDeleteMessageCount, that.autoDeleteMessageCount))
return false;
if (!Objects.equals(ringSize, that.ringSize))
return false;
if (!Objects.equals(configurationManaged, that.configurationManaged))
return false;
if (!Objects.equals(temporary, that.temporary))
return false;
if (!Objects.equals(autoCreateAddress, that.autoCreateAddress))
return false;
if (!Objects.equals(internal, that.internal))
return false;
if (!Objects.equals(_transient, that._transient))
return false;
if (!Objects.equals(autoCreated, that.autoCreated))
return false;
if (!Objects.equals(fqqn, that.fqqn))
return false;

return true;
}
if (!(obj instanceof QueueConfiguration other)) {
return false;
}

return Objects.equals(id, other.id) &&
Objects.equals(name, other.name) &&
Objects.equals(address, other.address) &&
Objects.equals(routingType, other.routingType) &&
Objects.equals(filterString, other.filterString) &&
Objects.equals(durable, other.durable) &&
Objects.equals(user, other.user) &&
Objects.equals(maxConsumers, other.maxConsumers) &&
Objects.equals(exclusive, other.exclusive) &&
Objects.equals(groupRebalance, other.groupRebalance) &&
Objects.equals(groupRebalancePauseDispatch, other.groupRebalancePauseDispatch) &&
Objects.equals(groupBuckets, other.groupBuckets) &&
Objects.equals(groupFirstKey, other.groupFirstKey) &&
Objects.equals(lastValue, other.lastValue) &&
Objects.equals(lastValueKey, other.lastValueKey) &&
Objects.equals(nonDestructive, other.nonDestructive) &&
Objects.equals(purgeOnNoConsumers, other.purgeOnNoConsumers) &&
Objects.equals(enabled, other.enabled) &&
Objects.equals(consumersBeforeDispatch, other.consumersBeforeDispatch) &&
Objects.equals(delayBeforeDispatch, other.delayBeforeDispatch) &&
Objects.equals(consumerPriority, other.consumerPriority) &&
Objects.equals(autoDelete, other.autoDelete) &&
Objects.equals(autoDeleteDelay, other.autoDeleteDelay) &&
Objects.equals(autoDeleteMessageCount, other.autoDeleteMessageCount) &&
Objects.equals(ringSize, other.ringSize) &&
Objects.equals(configurationManaged, other.configurationManaged) &&
Objects.equals(temporary, other.temporary) &&
Objects.equals(autoCreateAddress, other.autoCreateAddress) &&
Objects.equals(internal, other.internal) &&
Objects.equals(_transient, other._transient) &&
Objects.equals(autoCreated, other.autoCreated) &&
Objects.equals(fqqn, other.fqqn);
}

public boolean isMirrorQueue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,15 @@ public String[] getPaths(final char separator) {
}

@Override
public boolean equals(final Object other) {
if (this == other) {
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}

if (other instanceof SimpleString simpleString) {
return ByteUtil.equals(data, simpleString.data);
} else {
if (!(obj instanceof SimpleString other)) {
return false;
}

return ByteUtil.equals(data, other.data);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ public String toString() {

@Override
public boolean equals(Object obj) {
if (obj instanceof JsonValueImpl jsonValue) {
return rawValue.equals(jsonValue.getRawValue());
if (this == obj) {
return true;
}
return super.equals(obj);
if (!(obj instanceof JsonValueImpl other)) {
return false;
}

return Objects.equals(rawValue, other.getRawValue());
}

@Override
public int hashCode() {
return rawValue.hashCode();
return Objects.hashCode(rawValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ public static byte[] stringToBytes(String uuid) {
* Checking equality of UUIDs is easy; just compare the 128-bit number.
*/
@Override
public boolean equals(final Object o) {
if (!(o instanceof UUID)) {
public boolean equals(final Object obj) {
if (!(obj instanceof UUID)) {
return false;
}
byte[] otherId = ((UUID) o).mId;
byte[] otherId = ((UUID) obj).mId;
byte[] thisId = mId;
for (int i = 0; i < 16; ++i) {
if (otherId[i] != thisId[i]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,18 @@ public boolean containsAll(final LongHashSet other) {
* {@inheritDoc}
*/
@Override
public boolean equals(final Object other) {
if (other == this) {
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}

if (other instanceof LongHashSet otherSet) {

return otherSet.containsMissingValue == containsMissingValue && otherSet.sizeOfArrayValues == sizeOfArrayValues && containsAll(otherSet);
if (obj instanceof LongHashSet other) {
return other.containsMissingValue == containsMissingValue &&
other.sizeOfArrayValues == sizeOfArrayValues &&
containsAll(other);
}

if (!(other instanceof Set<?> c)) {
if (!(obj instanceof Set<?> c)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public Set<Entry<K, V>> entrySet() {
}

@Override
public boolean equals(Object o) {
return (o instanceof Map m) && m.isEmpty();
public boolean equals(Object obj) {
return (obj instanceof Map other) && other.isEmpty();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,37 +266,26 @@ public MYClass setBoolValue(boolean boolValue) {
}

@Override
public boolean equals(Object o) {
if (this == o)
public boolean equals(Object obj) {
if (this == obj) {
return true;
if (o == null || getClass() != o.getClass())
}
if (!(obj instanceof MYClass other)) {
return false;

MYClass myClass = (MYClass) o;

if (b != myClass.b)
return false;
if (boolValue != myClass.boolValue)
return false;
if (!Objects.equals(a, myClass.a))
return false;
if (!Objects.equals(c, myClass.c))
return false;
if (!Objects.equals(d, myClass.d))
return false;
if (!Objects.equals(idCacheSize, myClass.idCacheSize))
return false;
if (!Objects.equals(simpleString, myClass.simpleString))
return false;
if (!Objects.equals(gated, myClass.gated))
return false;
if (!Objects.equals(longValue, myClass.longValue))
return false;
if (!Objects.equals(doubleValue, myClass.doubleValue))
return false;
if (!Objects.equals(floatValue, myClass.floatValue))
return false;
return myEnum == myClass.myEnum;
}

return Objects.equals(a, other.a) &&
b == other.b &&
boolValue == other.boolValue &&
Objects.equals(c, other.c) &&
Objects.equals(d, other.d) &&
Objects.equals(idCacheSize, other.idCacheSize) &&
Objects.equals(simpleString, other.simpleString) &&
Objects.equals(gated, other.gated) &&
Objects.equals(longValue, other.longValue) &&
Objects.equals(doubleValue, other.doubleValue) &&
Objects.equals(floatValue, other.floatValue) &&
myEnum == other.myEnum;
}

@Override
Expand Down
Loading