diff --git a/governator-core/src/main/java/com/netflix/governator/SingletonModule.java b/governator-core/src/main/java/com/netflix/governator/SingletonModule.java index a7238d74..ff19fe80 100644 --- a/governator-core/src/main/java/com/netflix/governator/SingletonModule.java +++ b/governator-core/src/main/java/com/netflix/governator/SingletonModule.java @@ -11,9 +11,21 @@ * be final. This is done to prevent the use of inheritance for overriding * behavior in favor of using Modules.override(). * - * @author elandau - * + * @deprecated Extend AbstractModule directly and add the following equals and hashCode + * + * {@code + @Override + public boolean equals(Object obj) { + return obj != null && getClass().equals(obj.getClass()); + } + + @Override + public int hashCode() { + return getClass().hashCode(); + } + } */ +@Deprecated public abstract class SingletonModule extends AbstractModule { public SingletonModule() { if (!Modifier.isFinal(getClass().getModifiers())) { @@ -27,7 +39,7 @@ protected void configure() { @Override public boolean equals(Object obj) { - return getClass().equals(obj.getClass()); + return obj != null && getClass().equals(obj.getClass()); } @Override