cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Eclipse 3.1's "Unnecessary else statement"
Date Thu, 09 Jun 2005 09:37:10 GMT
Hi all,

I noticed for a while that many commits are related to "making Eclipse 
happier" because of an additional 3.1 feature that flags "unnecessary 
else statement".

These changes are for constructs such as:
    if (condition) {
        return foo;
    } else {
        return bar;

which are changed to:
    if (condition) {
        return foo;
    return bar;

I find the second form less readable than the first one and would like 
to ask people to change their Eclipse compiler settings to ignore these 
"unnecessary else statement".

Notice that such constructs are actually a more readable way to write
    return condition ? foo : bar;
and that the reformating makes it even worse!

Where I find this construct appropriate though, is for checking 
preconditions before large bunches of code:
    if (!precond) {
        return null;
    ... large section of code ...
    return result;

So please, update your settings and leave unchanged what doesn't need to 
be changed :-)


Sylvain Wallez                        Anyware Technologies  
Apache Software Foundation Member     Research & Technology Director

View raw message