java - FindBugs: overridden equals() causing static code analysis error EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS -


i getting findbugs error confused how fix. since old, legacy code, can not it. equals() implementation, not perfect doing job, shows error @ static code analysis.

findbugs error:

eq_check_for_operand_not_compatible_with_this equals checks incompatible operand

any suggestions on how fix this?

i did make couple of tweaks not prevent error.

class account extends managedaccount{      string accountid;     public void setaccount(entityid value) {         //some setter     }     void entityid getaccountid() {         return entityid;//entityid class     }      public boolean equals(object o) {         if (o instanceof account) {             if (this.getaccountid().equals(o))) {                 return super.equals(o);             }         }         return false;     } } 

probably findbugs triggers @ third line of equals method:

if (this.getaccountid().equals(o))) 

there strange here. compare this.getaccountid() entire object o.

just fix line , should fine.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -