brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Active partial rebind allowing ca...
Date Mon, 09 Feb 2015 13:39:57 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/506#discussion_r24327857
  
    --- 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 --
    
    You're right - it's not braking the official hashCode contract. It would just be wrong
to put a spec in a `HashSet` and then modify it.
    
    The spec is used like a builder, so tricky to make it immutable. We could have a `build`
method (or `toImmutable` or some such), but I don't think it's a big deal.
    
    Agree moving it to a test utility would be much harder to find (i.e. bad).
    
    I'm happy to leave as-is in this PR.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message