[ pmd-Bugs-2782688 ] OverrideBothEqualsAndHashcode bug with interfaces

View: New views
1 Messages — Rating Filter:   Alert me  

[ pmd-Bugs-2782688 ] OverrideBothEqualsAndHashcode bug with interfaces

by SourceForge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bugs item #2782688, was opened at 2009-04-28 10:43
Message generated for change (Settings changed) made by deathbyaclown
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2782688&group_id=56262

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: pmd
Group: None
>Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andreas (deathbyaclown)
Assigned to: Romain PELISSE (rpelisse)
Summary: OverrideBothEqualsAndHashcode bug with interfaces

Initial Comment:
Hope this is a) a real bug and b) not posted yet (havent found anything here)

OverrideBothEqualsAndHashcode does not work correctly with classes implementing an interface.

Example:

package de.my.package.ui;

// PMD reports correctly a violation prio 1
public class XX {
    public boolean equals(Object obj) {
        return true;
    }
}

package de.my.package.ui;

// PMD does NOT report a violation
public class YY implements java.io.Serializable {
    public boolean equals(Object obj) {
        return true;
    }
}

We are using PMD 4.2.5 and Eclipse 3.4.2

Thanks

----------------------------------------------------------------------

>Comment By: Andreas (deathbyaclown)
Date: 2009-09-11 08:08

Message:
Any new status for that ?

----------------------------------------------------------------------

Comment By: Andreas (deathbyaclown)
Date: 2009-04-28 13:15

Message:
I ran PMD on console with the classes above.

> pmd XX.java xml basic

<?xml version="1.0" encoding="UTF-8"?>
<pmd version="4.2.5" timestamp="2009-04-28T13:13:45.077">
<file name="C:\Dokumente und
Einstellungen\gisja\Desktop\download\pmd-4.2.5\bin\XX.java">
<violation beginline="2" endline="2" begincolumn="20" endcolumn="35"
rule="OverrideBothEqualsAndHashcode" ruleset="Basic Rules" class="XX"
method="equals"
externalInfoUrl="http://pmd.sourceforge.net/rules/basic.html#OverrideBothEqualsAndHashcode"
priority="3">
Ensure you override both equals() and hashCode()
</violation>
</file>
</pmd>

So this is correct....

with the YY.java class:

> pmd YY.java xml basic

<?xml version="1.0" encoding="UTF-8"?>
<pmd version="4.2.5" timestamp="2009-04-28T13:14:23.685">
</pmd>

Which is NOT correct - should have complained

This was done with a fresh download of pmd 4.2.5

Thanks


----------------------------------------------------------------------

Comment By: Romain PELISSE (rpelisse)
Date: 2009-04-28 11:08

Message:
I failed to reproduce your issue.... Would mind try to reproduce it out of
Eclipse (using a pmd command line or inside ant/maven) ?

Thanks.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2782688&group_id=56262

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Pmd-devel mailing list
Pmd-devel@...
https://lists.sourceforge.net/lists/listinfo/pmd-devel