Skip to content

Commit

Permalink
Merge pull request #367 from elandau/bugfix/SIngletonModule_equals
Browse files Browse the repository at this point in the history
Fix and deprecate SingletonModule
  • Loading branch information
elandau authored Jun 12, 2017
2 parents 4da850d + 6bb7aa0 commit c85c63f
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand All @@ -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
Expand Down

0 comments on commit c85c63f

Please sign in to comment.