Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/506#discussion_r24320780
--- Diff: api/src/main/java/brooklyn/basic/AbstractBrooklynObjectSpec.java
---
@@ -121,4 +121,21 @@ protected final void checkIsImplementation(Class<?>
val, Class<? super T> requir
if (Modifier.isAbstract(val.getModifiers())) throw new
IllegalStateException("Implementation "+val+" is abstract, but must be a
non-abstract class");
}
+ @Override
+ public boolean equals(Object obj) {
+ if (obj==null) return false;
--- End diff --
I'm slightly hesitant about equals/hashCode on mutable objects. It
potentially breaks the contract if two objects that were equal then become
not-equal and the hashCode changes (http://stackoverflow.com/a/4718059/1393883).
Guessing this is just used for tests? Perhaps having a utility class for
comparisons would be safer?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---