You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/01/05 03:36:54 UTC

[jira] Created: (DBCP-317) Findbugs: Class doesn't override equals in superclass

Findbugs: Class doesn't override equals in superclass
-----------------------------------------------------

                 Key: DBCP-317
                 URL: https://issues.apache.org/jira/browse/DBCP-317
             Project: Commons Dbcp
          Issue Type: Bug
            Reporter: Sebb
            Priority: Minor


Findbugs: Class doesn't override equals in superclass - 8 instances

"This class extends a class that defines an equals method and adds fields, but doesn't define an equals method itself. Thus, equality on instances of this class will ignore the identity of the subclass and the added fields. Be sure this is what is intended, and that you don't need to override the equals method. Even if you don't need to override the equals method, consider overriding it anyway to document the fact that the equals method for the subclass just return the result of invoking super.equals(o). "

Classes (superclass) are:

cpdsadapter.ConnectionImpl doesn't override DelegatingConnection.equals
datasources.LRUMap doesn't override SequencedHashMap.equals
managed.ManagedConnection doesn't override DelegatingConnection.equals
managed.PoolableManagedConnection  doesn't override DelegatingConnection.equals
PoolableCallableStatement doesn't override DelegatingCallableStatement.equals
PoolableConnection doesn't override DelegatingConnection.equals
PoolablePreparedStatement doesn't override DelegatingPreparedStatement.equals
PoolingConnection doesn't override DelegatingConnection.equals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DBCP-317) Findbugs: Class doesn't override equals in superclass

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBCP-317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796503#action_12796503 ] 

Phil Steitz commented on DBCP-317:
----------------------------------

I don't want to make any changes to the collections class (LRUMap), which is OK.

The others are OK - working as designed - as the equals equivalence relation is defined by equality of underlying jdbc objects.  I am OK with vacuos override to document if that would make findbugs happier and the code easier to understand, though I am not sure it would make the code easier to understand.

> Findbugs: Class doesn't override equals in superclass
> -----------------------------------------------------
>
>                 Key: DBCP-317
>                 URL: https://issues.apache.org/jira/browse/DBCP-317
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>
> Findbugs: Class doesn't override equals in superclass - 8 instances
> "This class extends a class that defines an equals method and adds fields, but doesn't define an equals method itself. Thus, equality on instances of this class will ignore the identity of the subclass and the added fields. Be sure this is what is intended, and that you don't need to override the equals method. Even if you don't need to override the equals method, consider overriding it anyway to document the fact that the equals method for the subclass just return the result of invoking super.equals(o). "
> Classes (superclass) are:
> cpdsadapter.ConnectionImpl doesn't override DelegatingConnection.equals
> datasources.LRUMap doesn't override SequencedHashMap.equals
> managed.ManagedConnection doesn't override DelegatingConnection.equals
> managed.PoolableManagedConnection  doesn't override DelegatingConnection.equals
> PoolableCallableStatement doesn't override DelegatingCallableStatement.equals
> PoolableConnection doesn't override DelegatingConnection.equals
> PoolablePreparedStatement doesn't override DelegatingPreparedStatement.equals
> PoolingConnection doesn't override DelegatingConnection.equals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DBCP-317) Findbugs: Class doesn't override equals in superclass

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated DBCP-317:
----------------------

    Fix Version/s: 1.4

> Findbugs: Class doesn't override equals in superclass
> -----------------------------------------------------
>
>                 Key: DBCP-317
>                 URL: https://issues.apache.org/jira/browse/DBCP-317
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 1.4
>
>
> Findbugs: Class doesn't override equals in superclass - 8 instances
> "This class extends a class that defines an equals method and adds fields, but doesn't define an equals method itself. Thus, equality on instances of this class will ignore the identity of the subclass and the added fields. Be sure this is what is intended, and that you don't need to override the equals method. Even if you don't need to override the equals method, consider overriding it anyway to document the fact that the equals method for the subclass just return the result of invoking super.equals(o). "
> Classes (superclass) are:
> cpdsadapter.ConnectionImpl doesn't override DelegatingConnection.equals
> datasources.LRUMap doesn't override SequencedHashMap.equals
> managed.ManagedConnection doesn't override DelegatingConnection.equals
> managed.PoolableManagedConnection  doesn't override DelegatingConnection.equals
> PoolableCallableStatement doesn't override DelegatingCallableStatement.equals
> PoolableConnection doesn't override DelegatingConnection.equals
> PoolablePreparedStatement doesn't override DelegatingPreparedStatement.equals
> PoolingConnection doesn't override DelegatingConnection.equals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DBCP-317) Findbugs: Class doesn't override equals in superclass

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBCP-317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797078#action_12797078 ] 

Sebb commented on DBCP-317:
---------------------------

I've been looking into this further.

DelegatingPreparedStatement extends DelegatingStatement  and overrides equals() - but defines no extra fields
DelegatingCallableStatement extends DelegatingPreparedStatement  and overrides equals() - but defines no extra fields
Yet
PoolableCallableStatement extends DelegatingCallableStatement and has extra fields, but does not override equals()

This is quite confusing - why do the Delagating...Statement classes override equals when they don't have any extra state?
Indeed Findbugs warns that these equals methods may not be symmetric.

> Findbugs: Class doesn't override equals in superclass
> -----------------------------------------------------
>
>                 Key: DBCP-317
>                 URL: https://issues.apache.org/jira/browse/DBCP-317
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>
> Findbugs: Class doesn't override equals in superclass - 8 instances
> "This class extends a class that defines an equals method and adds fields, but doesn't define an equals method itself. Thus, equality on instances of this class will ignore the identity of the subclass and the added fields. Be sure this is what is intended, and that you don't need to override the equals method. Even if you don't need to override the equals method, consider overriding it anyway to document the fact that the equals method for the subclass just return the result of invoking super.equals(o). "
> Classes (superclass) are:
> cpdsadapter.ConnectionImpl doesn't override DelegatingConnection.equals
> datasources.LRUMap doesn't override SequencedHashMap.equals
> managed.ManagedConnection doesn't override DelegatingConnection.equals
> managed.PoolableManagedConnection  doesn't override DelegatingConnection.equals
> PoolableCallableStatement doesn't override DelegatingCallableStatement.equals
> PoolableConnection doesn't override DelegatingConnection.equals
> PoolablePreparedStatement doesn't override DelegatingPreparedStatement.equals
> PoolingConnection doesn't override DelegatingConnection.equals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DBCP-317) Findbugs: Class doesn't override equals in superclass

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated DBCP-317:
-----------------------------

    Fix Version/s:     (was: 1.4)
                   1.4.1
                   1.3.1

> Findbugs: Class doesn't override equals in superclass
> -----------------------------------------------------
>
>                 Key: DBCP-317
>                 URL: https://issues.apache.org/jira/browse/DBCP-317
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 1.3.1, 1.4.1
>
>
> Findbugs: Class doesn't override equals in superclass - 8 instances
> "This class extends a class that defines an equals method and adds fields, but doesn't define an equals method itself. Thus, equality on instances of this class will ignore the identity of the subclass and the added fields. Be sure this is what is intended, and that you don't need to override the equals method. Even if you don't need to override the equals method, consider overriding it anyway to document the fact that the equals method for the subclass just return the result of invoking super.equals(o). "
> Classes (superclass) are:
> cpdsadapter.ConnectionImpl doesn't override DelegatingConnection.equals
> datasources.LRUMap doesn't override SequencedHashMap.equals
> managed.ManagedConnection doesn't override DelegatingConnection.equals
> managed.PoolableManagedConnection  doesn't override DelegatingConnection.equals
> PoolableCallableStatement doesn't override DelegatingCallableStatement.equals
> PoolableConnection doesn't override DelegatingConnection.equals
> PoolablePreparedStatement doesn't override DelegatingPreparedStatement.equals
> PoolingConnection doesn't override DelegatingConnection.equals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DBCP-317) Findbugs: Class doesn't override equals in superclass

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBCP-317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated DBCP-317:
----------------------

    Affects Version/s: 1.4

> Findbugs: Class doesn't override equals in superclass
> -----------------------------------------------------
>
>                 Key: DBCP-317
>                 URL: https://issues.apache.org/jira/browse/DBCP-317
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Sebb
>            Priority: Minor
>
> Findbugs: Class doesn't override equals in superclass - 8 instances
> "This class extends a class that defines an equals method and adds fields, but doesn't define an equals method itself. Thus, equality on instances of this class will ignore the identity of the subclass and the added fields. Be sure this is what is intended, and that you don't need to override the equals method. Even if you don't need to override the equals method, consider overriding it anyway to document the fact that the equals method for the subclass just return the result of invoking super.equals(o). "
> Classes (superclass) are:
> cpdsadapter.ConnectionImpl doesn't override DelegatingConnection.equals
> datasources.LRUMap doesn't override SequencedHashMap.equals
> managed.ManagedConnection doesn't override DelegatingConnection.equals
> managed.PoolableManagedConnection  doesn't override DelegatingConnection.equals
> PoolableCallableStatement doesn't override DelegatingCallableStatement.equals
> PoolableConnection doesn't override DelegatingConnection.equals
> PoolablePreparedStatement doesn't override DelegatingPreparedStatement.equals
> PoolingConnection doesn't override DelegatingConnection.equals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.