You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Radim Kolar (JIRA)" <ji...@apache.org> on 2012/11/01 01:05:12 UTC

[jira] [Created] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Radim Kolar created CASSANDRA-4889:
--------------------------------------

             Summary: Code cleanup against JDK 1.6 codestyle guide
                 Key: CASSANDRA-4889
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
             Project: Cassandra
          Issue Type: Bug
    Affects Versions: 1.3
            Reporter: Radim Kolar
            Priority: Minor
         Attachments: cass-cleanup1.txt

Code cleanup against jdk1.6 ruleset on lowest settings.

problems fixed:
extra ;
unused imports
incorrect if (condition is always true or always false)
using static variable in non static way
always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Radim Kolar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radim Kolar updated CASSANDRA-4889:
-----------------------------------

    Attachment: cass-cleanup2.txt
    
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt, cass-cleanup2.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488638#comment-13488638 ] 

Dave Brosius commented on CASSANDRA-4889:
-----------------------------------------

i still think the assert needs to stay in CommitLogDescriptor
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt, cass-cleanup2.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Radim Kolar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488631#comment-13488631 ] 

Radim Kolar commented on CASSANDRA-4889:
----------------------------------------

your custom @override policy is not supported by my tool, patch regenerated and constant assert moved to unit test.
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt, cass-cleanup2.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Radim Kolar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13489195#comment-13489195 ] 

Radim Kolar commented on CASSANDRA-4889:
----------------------------------------

assert is for runtime checking, unit tests are for catching errors caused by code changes.
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt, cass-cleanup2.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Radim Kolar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488371#comment-13488371 ] 

Radim Kolar commented on CASSANDRA-4889:
----------------------------------------

findbugs discovered problems are not included because findbugs crash after finding about 500 problems.
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488599#comment-13488599 ] 

Sylvain Lebresne commented on CASSANDRA-4889:
---------------------------------------------

bq. What about adding missing @Override?

Depends of the definition of missing. http://wiki.apache.org/cassandra/CodeStyle explicitly said: "Avoid redundant @Override annotations when implementing abstract or interface methods". But as long as it's missing following that definition, then sure, why not.
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Radim Kolar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488594#comment-13488594 ] 

Radim Kolar commented on CASSANDRA-4889:
----------------------------------------

alright, if you dont like hamcrest. I will regenerate this with hamcrest disabled. What about adding missing @Override?
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Radim Kolar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radim Kolar updated CASSANDRA-4889:
-----------------------------------

    Attachment: cass-cleanup1.txt
    
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-4889:
--------------------------------------

    Reviewer: dbrosius
    Assignee: Radim Kolar
    
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488422#comment-13488422 ] 

Dave Brosius commented on CASSANDRA-4889:
-----------------------------------------

This assert
assert MessagingService.current_version == MessagingService.VERSION_12;
is there for when in the future the current_version changes, so that more cases are added to this method, and thus this assert should remain.

Not sure we want static imports used in cassandra
import static org.hamcrest.core.IsEqual.equalTo;


patch looks ok, other than that.
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13489211#comment-13489211 ] 

Jonathan Ellis commented on CASSANDRA-4889:
-------------------------------------------

asserts are to validate preconditions and other assumptions made by the developer, which includes the check mentioned by Dave here.  Rewriting it as a unit test would be silly.
                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt, cass-cleanup2.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4889) Code cleanup against JDK 1.6 codestyle guide

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488583#comment-13488583 ] 

Sylvain Lebresne commented on CASSANDRA-4889:
---------------------------------------------

{quote}
Not sure we want static imports used in cassandra
import static org.hamcrest.core.IsEqual.equalTo;
{quote}
I don't care so much about the static import, but as far as I can tell we don't use hamcrest in the code so far, and I'm -1 on adding the dependency just to replace
{noformat}
assert Character.MAX_CODE_POINT == 0x0010ffff;
{noformat}
by some harmcrest crap.

The changes in UpdateStatement and DeleteStatement are also not the one we want. That is, those are actually bugs, the break having be left in that code mistakenly. I've committed the fix for that so the patch will need to be rebased. Do be careful when doing "codestyle" fixes that when it's not a simple syntax change you do understand the code at stake to avoid burying a bug deeper than it is like it would have been the case here.

                
> Code cleanup against JDK 1.6 codestyle guide
> --------------------------------------------
>
>                 Key: CASSANDRA-4889
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4889
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Radim Kolar
>            Assignee: Radim Kolar
>            Priority: Minor
>              Labels: codestyle
>         Attachments: cass-cleanup1.txt
>
>
> Code cleanup against jdk1.6 ruleset on lowest settings.
> problems fixed:
> extra ;
> unused imports
> incorrect if (condition is always true or always false)
> using static variable in non static way
> always true asserts

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira