You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2011/09/14 21:42:51 UTC

Re: svn commit: r1170805 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java

On 14 September 2011 20:34,  <si...@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


Re: svn commit: r1170805 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java

Posted by Simone Tripodi <si...@apache.org>.
Hi Jörg!
Sounds I have a huge TODO list of fixes for tomorrow, I'm too tired to
fix them now, time to sleep :P
Thanks for the feedbacks and suggestions, have a nice day!
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Wed, Sep 14, 2011 at 10:52 PM, Jörg Schaible <jo...@gmx.de> wrote:
> 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 <se...@gmail.com> wrote:
>>> On 14 September 2011 20:34,  <si...@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
>
>

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


Re: svn commit: r1170805 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java

Posted by Jörg Schaible <jo...@gmx.de>.
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 <se...@gmail.com> wrote:
>> On 14 September 2011 20:34,  <si...@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


Re: svn commit: r1170805 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/TransformedBinaryProcedure.java

Posted by Simone Tripodi <si...@apache.org>.
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>)

yes, checkstyle complains about those violations[1]

anyways, every suggestion is more than welcome!
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 <se...@gmail.com> wrote:
> On 14 September 2011 20:34,  <si...@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