You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Damjan Jovanovic <da...@apache.org> on 2013/11/26 17:48:43 UTC

Re: svn commit: r1545710 - in /commons/proper/imaging/trunk: pmd-ruleset.xml pom.xml src/conf/pmd-ruleset.xml src/main/java/org/apache/commons/imaging/ColorTools.java

On Tue, Nov 26, 2013 at 6:18 PM,  <eb...@apache.org> wrote:
> Author: ebourg
> Date: Tue Nov 26 16:18:58 2013
> New Revision: 1545710
>
> URL: http://svn.apache.org/r1545710
> Log:
> Adjust PMD rules
>

> Copied: commons/proper/imaging/trunk/src/conf/pmd-ruleset.xml (from r1545174, commons/proper/imaging/trunk/pmd-ruleset.xml)
> URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/conf/pmd-ruleset.xml?p2=commons/proper/imaging/trunk/src/conf/pmd-ruleset.xml&p1=commons/proper/imaging/trunk/pmd-ruleset.xml&r1=1545174&r2=1545710&rev=1545710&view=diff
> ==============================================================================
> --- commons/proper/imaging/trunk/pmd-ruleset.xml (original)
> +++ commons/proper/imaging/trunk/src/conf/pmd-ruleset.xml Tue Nov 26 16:18:58 2013
> @@ -65,6 +65,8 @@
>    <rule ref="rulesets/java/migrating.xml"/>
>    <rule ref="rulesets/java/optimizations.xml">
>      <exclude name="AvoidInstantiatingObjectsInLoops"/>
> +    <exclude name="LocalVariableCouldBeFinal"/>
> +    <exclude name="MethodArgumentCouldBeFinal"/>
>      <exclude name="RedundantFieldInitializer"/>
>      <exclude name="PrematureDeclaration"/>
>    </rule>
>

Why are we excluding those? Final variables are a good thing.

Damjan

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


Re: svn commit: r1545710 - in /commons/proper/imaging/trunk: pmd-ruleset.xml pom.xml src/conf/pmd-ruleset.xml src/main/java/org/apache/commons/imaging/ColorTools.java

Posted by Gary Gregory <ga...@gmail.com>.
On Tue, Nov 26, 2013 at 1:40 PM, Emmanuel Bourg <eb...@apache.org> wrote:

> Le 26/11/2013 19:18, Gary Gregory a écrit :
>
> > I disagree, final everywhere is a good thing, please see
> > http://garygregory.wordpress.com/2013/01/26/the-final-kiss-in-java/
>
> Well, I guess we agree to disagree then :) Final everywhere is absurd
> imho, there are many cases where it's useless and increase the verbosity
> of the code, for example:
>
>     public ImageReadException(final String message) {
>         super(message);
>     }
>

Au contraire, final says that the reference to message is guaranteed to be
unchanged.

It is obvious in a one liner such as this one, but consistency is kind IMO.
When I see method after method that declare params as final (read only), I
can turn on my radar when I see one declared as read-write (by not using
final).

Gary


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


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: svn commit: r1545710 - in /commons/proper/imaging/trunk: pmd-ruleset.xml pom.xml src/conf/pmd-ruleset.xml src/main/java/org/apache/commons/imaging/ColorTools.java

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 26/11/2013 19:18, Gary Gregory a écrit :

> I disagree, final everywhere is a good thing, please see
> http://garygregory.wordpress.com/2013/01/26/the-final-kiss-in-java/

Well, I guess we agree to disagree then :) Final everywhere is absurd
imho, there are many cases where it's useless and increase the verbosity
of the code, for example:

    public ImageReadException(final String message) {
        super(message);
    }

Emmanuel Bourg


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


Re: svn commit: r1545710 - in /commons/proper/imaging/trunk: pmd-ruleset.xml pom.xml src/conf/pmd-ruleset.xml src/main/java/org/apache/commons/imaging/ColorTools.java

Posted by Gary Gregory <ga...@gmail.com>.
On Tue, Nov 26, 2013 at 12:58 PM, Emmanuel Bourg <eb...@apache.org> wrote:

> Le 26/11/2013 17:48, Damjan Jovanovic a écrit :
>
> > Why are we excluding those? Final variables are a good thing.
>
> Yes but final everywhere is a bit extreme and makes the code too verbose.
>

I disagree, final everywhere is a good thing, please see
http://garygregory.wordpress.com/2013/01/26/the-final-kiss-in-java/

Gary


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


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: svn commit: r1545710 - in /commons/proper/imaging/trunk: pmd-ruleset.xml pom.xml src/conf/pmd-ruleset.xml src/main/java/org/apache/commons/imaging/ColorTools.java

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 26/11/2013 17:48, Damjan Jovanovic a écrit :

> Why are we excluding those? Final variables are a good thing.

Yes but final everywhere is a bit extreme and makes the code too verbose.

Emmanuel Bourg


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