Defect on rule "Missing inheritance check"

CodePro AnalytiX (Audit & Test), includes over 1000 audit rules and metrics, JUnit test generation & editing, code coverage, and duplicate code analysis

Moderators: gnebling, jwren, Eric Clayberg, Dan Rubel, Brian Wilkerson, dcarew

Defect on rule "Missing inheritance check"

Postby jaypi » Tue Mar 22, 2011 7:43 am

this is flagged as a violation :

public boolean equals(Object pParam)
{
if(pParam instanceof myClass)
{
if(compareTo(pParam) == 0
|| super.equals(pParam))
{
return true;
}
return false;
}
return false;
}

Description

Missing inheritance check

Explanation

The equals method should check that the parameter is an instanceof the same class or interface as this object.

Recommendation

1. Add an instanceof test.
jaypi
 
Posts: 1
Joined: Tue Mar 22, 2011 7:40 am

Re: Defect on rule "Missing inheritance check"

Postby gnebling » Mon Apr 18, 2011 9:29 am

Seems like a bug. Will include in our bugs list to fix sometime in the future. Thanks for your report.
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am


Return to CodePro AnalytiX & PlusPak. EclipsePro Audit & Test

Who is online

Users browsing this forum: No registered users and 1 guest

cron