Skip to content

Commit

Permalink
Suppress error for bad implementations of Comparable
Browse files Browse the repository at this point in the history
RELNOTES=N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=236248361
  • Loading branch information
cushon authored and cgdecker committed Mar 7, 2019
1 parent dcaf893 commit c371307
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ public OutputStream openStream() {
// Compare by toString() to satisfy 2 properties:
// 1. compareTo(null) should throw NullPointerException
// 2. the order is deterministic and easy to understand, for debugging purpose.
@SuppressWarnings("ComparableType")
private static final class ByToString implements Comparable<Object>, Serializable {
private static final ByToString INSTANCE = new ByToString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*
* @author Kevin Bourrillion
*/
@SuppressWarnings("ComparableType")
@GwtCompatible
class LegacyComparable implements Comparable, Serializable {
static final LegacyComparable X = new LegacyComparable("x");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public String toString() {
}
}

@SuppressWarnings("ComparableType")
private static class ComparableSubClass extends NonComparableSuperClass
implements Comparable<NonComparableSuperClass> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ public OutputStream openStream() {
// Compare by toString() to satisfy 2 properties:
// 1. compareTo(null) should throw NullPointerException
// 2. the order is deterministic and easy to understand, for debugging purpose.
@SuppressWarnings("ComparableType")
private static final class ByToString implements Comparable<Object>, Serializable {
private static final ByToString INSTANCE = new ByToString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*
* @author Kevin Bourrillion
*/
@SuppressWarnings("ComparableType")
@GwtCompatible
class LegacyComparable implements Comparable, Serializable {
static final LegacyComparable X = new LegacyComparable("x");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public String toString() {
}
}

@SuppressWarnings("ComparableType")
private static class ComparableSubClass extends NonComparableSuperClass
implements Comparable<NonComparableSuperClass> {

Expand Down

0 comments on commit c371307

Please sign in to comment.