cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request: findbugs equals(obj) implementations go a...
Date Wed, 01 Jul 2015 06:04:19 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/535#discussion_r33650706
  
    --- Diff: framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java ---
    @@ -122,6 +122,13 @@ public boolean equals(Object obj) {
             if (obj instanceof ConfigKey) {
                 ConfigKey<?> that = (ConfigKey<?>)obj;
                 return this._name.equals(that._name);
    +        }
    +        return false;
    +    }
    +
    +    public boolean isSameKeyAs(Object obj) {
    +        if(this.equals(obj)) {
    +            return true;
             } else if (obj instanceof String) {
    --- End diff --
    
    @DaanHoogland we shouldn't make assumptions about the loading behavior of a class.  We
should write our equals implementations defensively.  Another issue with instanceof is that
it returns true for compatible subclasses which is also incorrect from an equals perspective.


---
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