commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@gmx.de>
Subject Re: svn commit: r1170805 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
Date Wed, 14 Sep 2011 20:52:22 GMT
Hi Simo,

Simone Tripodi wrote:

> we already discussed about it, and choose the option to let users
> extend the classes for 2 reasons:
>  - be reused inside IoC/DI containers that create dynamic proxies
>  - specialize classes with generic types (class
> MyTransformedBinaryProcedure extends TransformedBinaryProcedure<MyL,
> MyR, MyT>)

then a final hashCode is simply wrong (same with equals, toString, ...)

> yes, checkstyle complains about those violations[1]

adjust the rules if they enforce brain-dead code

> anyways, every suggestion is more than welcome!

- Jörg

> Simo
> 
> [1] http://commons.apache.org/sandbox/functor/checkstyle.html
> 
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
> 
> 
> 
> On Wed, Sep 14, 2011 at 9:42 PM, sebb <sebbaz@gmail.com> wrote:
>> On 14 September 2011 20:34,  <simonetripodi@apache.org> wrote:
>>> Author: simonetripodi
>>> Date: Wed Sep 14 19:34:37 2011
>>> New Revision: 1170805
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1170805&view=rev
>>> Log:
>>> fixed checkstyle violation: Method 'hashCode' is not designed for
>>> extension - needs to be abstract, final or empty
>>
>> Is the class intended for extension?
>> If so, and you add fields, you won't be able to override hashCode to
>> take account of them.
>> If not, just make the class final.
>>
>> Are you sure that the Checkstyle complaint is valid here?
>>
>>> Modified:
>>> 
commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
>>>
>>> Modified:
>>> 
commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
>>> URL:
>>> 
http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java?rev=1170805&r1=1170804&r2=1170805&view=diff
>>> 
==============================================================================
>>> ---
>>> 
commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
>>> (original) +++
>>> 
commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java
>>> Wed Sep 14 19:34:37 2011 @@ -107,7 +107,7 @@ public class
>>> TransformedBinaryProcedure< * {@inheritDoc} */ @Override -    public int
>>> hashCode() { +    public final int hashCode() { int result =
>>> "TransformedBinaryProcedure".hashCode(); result <<= 2;
>>> result |= helper.procedure.hashCode();
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message