You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2012/10/06 19:48:26 UTC

Java style for return statements

Hi I see:

org.apache.logging.log4j.Level.isAtLeastAsSpecificAs(Level):

    public boolean isAtLeastAsSpecificAs(Level level) {
        return (intLevel <= level.intLevel);
    }

I flashback to my C coding days...

Can we use plain old:

        return intLevel <= level.intLevel;

?

Gary
-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Java style for return statements

Posted by Gary Gregory <ga...@gmail.com>.
OK, done (where I found them.)

Gary

On Sat, Oct 6, 2012 at 1:56 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> That one is a habit I fight constantly - and you are right, I code in C
> for a lot of years, but that was a long time ago.  I'm not sure why
> checkstyle doesn't flag it.
>
> So, yes.  The parens should be removed.
>
> Ralph
>
> On Oct 6, 2012, at 10:48 AM, Gary Gregory wrote:
>
> Hi I see:
>
> org.apache.logging.log4j.Level.isAtLeastAsSpecificAs(Level):
>
>     public boolean isAtLeastAsSpecificAs(Level level) {
>         return (intLevel <= level.intLevel);
>     }
>
> I flashback to my C coding days...
>
> Can we use plain old:
>
>         return intLevel <= level.intLevel;
>
> ?
>
> Gary
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977/>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Java style for return statements

Posted by Ralph Goers <ra...@dslextreme.com>.
That one is a habit I fight constantly - and you are right, I code in C for a lot of years, but that was a long time ago.  I'm not sure why checkstyle doesn't flag it.

So, yes.  The parens should be removed.

Ralph

On Oct 6, 2012, at 10:48 AM, Gary Gregory wrote:

> Hi I see:
> 
> org.apache.logging.log4j.Level.isAtLeastAsSpecificAs(Level):
> 
>     public boolean isAtLeastAsSpecificAs(Level level) {
>         return (intLevel <= level.intLevel);
>     }
> 
> I flashback to my C coding days...
> 
> Can we use plain old:
> 
>         return intLevel <= level.intLevel;
> 
> ?
> 
> Gary
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
> Spring Batch in Action: http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory