From f49df2d895602595ee818822f0223eb2c315e1d6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 9 Dec 2017 17:23:14 +0000 Subject: [PATCH] Remove need in equals() for explicit type --- src/main/java/net/kemitix/mon/TypeAlias.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/kemitix/mon/TypeAlias.java b/src/main/java/net/kemitix/mon/TypeAlias.java index f5dc0c5..92ef4cb 100644 --- a/src/main/java/net/kemitix/mon/TypeAlias.java +++ b/src/main/java/net/kemitix/mon/TypeAlias.java @@ -75,11 +75,11 @@ public abstract class TypeAlias { @SuppressWarnings("unchecked") public final boolean equals(final Object o) { if (o instanceof TypeAlias) { - if (((TypeAlias) o).type.equals(type)) { - return ((TypeAlias) o).map(getValue()::equals); - } else { - return false; - } + final TypeAlias other = (TypeAlias) o; + final Object otherValue = other.getValue(); + final Class otherValueClass = otherValue.getClass(); + return otherValueClass.equals(getValue().getClass()) + && otherValue.equals(getValue()); } return map(o::equals); }