Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696894118
  • Loading branch information
cpovirk authored and copybara-github committed Nov 17, 2024
1 parent 1dee726 commit 2e24e05
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ abstract class AbstractProtobufList<E> extends AbstractList<E> implements Protob
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (o == this) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ protected void removeRange(int fromIndex, int toIndex) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
9 changes: 6 additions & 3 deletions java/core/src/main/java/com/google/protobuf/ByteString.java
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,8 @@ public final String toStringUtf8() {
// equals() and hashCode()

@Override
public abstract boolean equals(Object o);
public abstract boolean equals(
Object o);

/** Base class for leaf {@link ByteString}s (i.e. non-ropes). */
abstract static class LeafByteString extends ByteString {
Expand Down Expand Up @@ -1478,7 +1479,8 @@ protected final int partialIsValidUtf8(int state, int offset, int length) {
// equals() and hashCode()

@Override
public final boolean equals(Object other) {
public final boolean equals(
Object other) {
if (other == this) {
return true;
}
Expand Down Expand Up @@ -1816,7 +1818,8 @@ protected int partialIsValidUtf8(int state, int offset, int length) {
}

@Override
public boolean equals(Object other) {
public boolean equals(
Object other) {
if (other == this) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ protected void removeRange(int fromIndex, int toIndex) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion java/core/src/main/java/com/google/protobuf/FieldSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public boolean isImmutable() {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ protected void removeRange(int fromIndex, int toIndex) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ protected void removeRange(int fromIndex, int toIndex) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion java/core/src/main/java/com/google/protobuf/Internal.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ public V setValue(V value) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (o == this) {
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion java/core/src/main/java/com/google/protobuf/LazyField.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public int hashCode() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(
Object obj) {
return getValue().equals(obj);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public static LazyFieldLite fromValue(MessageLite value) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ protected void removeRange(int fromIndex, int toIndex) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions java/core/src/main/java/com/google/protobuf/MapField.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ public void clear() {

@SuppressWarnings("unchecked")
@Override
public boolean equals(Object object) {
public boolean equals(
Object object) {
if (!(object instanceof MapField)) {
return false;
}
Expand Down Expand Up @@ -338,7 +339,8 @@ public Set<java.util.Map.Entry<K, V>> entrySet() {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
return delegate.equals(o);
}

Expand Down Expand Up @@ -434,7 +436,8 @@ public void clear() {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
return delegate.equals(o);
}

Expand Down Expand Up @@ -531,7 +534,8 @@ public void clear() {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
return delegate.equals(o);
}

Expand Down Expand Up @@ -573,7 +577,8 @@ public void remove() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(
Object obj) {
return delegate.equals(obj);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ private boolean typedEquals(MapFieldBuilder<KeyT, MessageOrBuilderT, MessageT, B

@SuppressWarnings("unchecked")
@Override
public boolean equals(Object object) {
public boolean equals(
Object object) {
if (!(object instanceof MapFieldBuilder)) {
return false;
}
Expand Down
7 changes: 5 additions & 2 deletions java/core/src/main/java/com/google/protobuf/MapFieldLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ private static void checkForNullKeysAndValues(Map<?, ?> m) {
}
}

private static boolean equals(Object a, Object b) {
private static boolean equals(
Object a,
Object b) {
if (a instanceof byte[] && b instanceof byte[]) {
return Arrays.equals((byte[]) a, (byte[]) b);
}
Expand Down Expand Up @@ -129,7 +131,8 @@ static <K, V> boolean equals(Map<K, V> a, Map<K, V> b) {
/** Checks whether two map fields are equal. */
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object object) {
public boolean equals(
Object object) {
return (object instanceof Map) && equals(this, (Map<K, V>) object);
}

Expand Down
3 changes: 2 additions & 1 deletion java/core/src/main/java/com/google/protobuf/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public interface Message extends MessageLite, MessageOrBuilder {
* @return {@code true} if the specified object is equal to this message
*/
@Override
boolean equals(Object other);
boolean equals(
Object other);

/**
* Returns the hash code value for this message. The hash code of a message should mix the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ protected int partialIsValidUtf8(int state, int offset, int length) {
// equals() and hashCode()

@Override
public boolean equals(Object other) {
public boolean equals(
Object other) {
if (other == this) {
return true;
}
Expand Down
10 changes: 7 additions & 3 deletions java/core/src/main/java/com/google/protobuf/SmallSortedMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ public V setValue(V newValue) {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (o == this) {
return true;
}
Expand All @@ -439,7 +440,9 @@ public String toString() {
}

/** equals() that handles null values. */
private boolean equals(Object o1, Object o2) {
private boolean equals(
Object o1,
Object o2) {
return o1 == null ? o2 == null : o1.equals(o2);
}
}
Expand Down Expand Up @@ -609,7 +612,8 @@ private Iterator<Map.Entry<K, V>> getOverflowIterator() {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (this == o) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public String toString() {
}

@Override
public boolean equals(Object o) {
public boolean equals(
Object o) {
if (o == this) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public UnknownFieldSet getDefaultInstanceForType() {
new UnknownFieldSet(new TreeMap<Integer, Field>());

@Override
public boolean equals(Object other) {
public boolean equals(
Object other) {
if (this == other) {
return true;
}
Expand Down Expand Up @@ -739,7 +740,8 @@ public List<UnknownFieldSet> getGroupList() {
}

@Override
public boolean equals(Object other) {
public boolean equals(
Object other) {
if (this == other) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ private static boolean objectsEquals(Object[] objects1, Object[] objects2, int c
}

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

0 comments on commit 2e24e05

Please sign in to comment.