You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org> on 2009/07/23 07:11:14 UTC

[jira] Created: (AVRO-82) A large number of Java warnings due to unused vairables etc.

A large number of Java warnings due to unused vairables etc.
------------------------------------------------------------

                 Key: AVRO-82
                 URL: https://issues.apache.org/jira/browse/AVRO-82
             Project: Avro
          Issue Type: Improvement
          Components: java
            Reporter: Thiruvalluvan M. G.
            Assignee: Thiruvalluvan M. G.
            Priority: Minor


I', creating this JIRA to submit a patch that fix the following:
   - Unused imports
   - Unused private fields, local variables
   - Use of generic types without parameters
   - Missing setialVersionUID for serializable classes

There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-82:
------------------------------------

    Attachment:     (was: AVRO-81.patch)

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch, AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12734662#action_12734662 ] 

Doug Cutting commented on AVRO-82:
----------------------------------

These are warnings from your IDE, not warnings seen when building with Ant, right?  Compiling with Ant generates no warnings for me.  Perhaps we should add Checkstyle and/or FindBugs to the Ant compilation if we wish to raise the warning bar?

Also some of the unused fields are fields that should perhaps remain.  For example, in DataFileReader the bug is that we're missing a 'getCount()' accessor, not that we have an unused field.  And in Requestor and Responder, those local variables will soon be used by AVRO-66, a patch we don't want to generate spurious conflicts with.

Removing unused imports seems fine, but rearranging imports can break other patches.  Also, replacing a wildcard import with a non-wildcarded long-term makes future unused imports more likely for folks like me who do not use an IDE (unless we add an equivalent Checkstyle test).  So, again, I'm hesitant to encourage periodic cleanups of this sort without automatic testing that's common to all developers.

If we add Checkstyle and/or FindBugs to Ant compilation, to be effective, we should fail tests if there are any warnings.  Both support the suppression of warnings for specific files, if needed.

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-82:
------------------------------------

    Status: Patch Available  (was: Open)

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-82) A large number of Java warnings due to unused vairables etc.

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

Doug Cutting updated AVRO-82:
-----------------------------

    Status: Open  (was: Patch Available)

Let's add Checkstyle to the build before we commit something like this, so the changes are maintainable by all.

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AVRO-82) A large number of Java warnings due to unused vairables etc.

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

Doug Cutting resolved AVRO-82.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0.1

I just committed this with a few changes:
 - added a few more checks;
 - made it so that so unit tests will not pass if checkstyle fails;
 - since checkstyle is LGPL, we cannot bundle it.  I improved our use of Ivy so that code that's only required to run tests is not bundled.  This also improves dependencies in our generated Maven POM file.

> The main reason for me create this JIRA is to avoid the large number of warnings I see in Eclipse.

Can you change your Eclipse settings, so that its warnings match those of checkstyle?  Perhaps we could even include an appropriate Eclipse settings file with the project.

Thanks, Thiru!

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>             Fix For: 1.0.1
>
>         Attachments: AVRO-82.patch, AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Scott Carey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12734670#action_12734670 ] 

Scott Carey commented on AVRO-82:
---------------------------------

Or, I believe you can just change the options that Ant is passing to javac, and add -Xlint.  I'm not sure if that addresses all of the above, but it does for 3 of the four for sure.

http://java.sun.com/javase/6/docs/technotes/tools/solaris/javac.html




> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-82:
------------------------------------

    Attachment: AVRO-82.patch

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch, AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-82:
------------------------------------

    Attachment: AVRO-82.patch

> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12734683#action_12734683 ] 

Doug Cutting commented on AVRO-82:
----------------------------------

> you can just change the options that Ant is passing to javac, and add -Xlint

In place of the 50 warnings addressed above, this generates 20 warnings.  The intersection between the sets is around 15, i.e., -Xlint generates warnings that Thiru's IDE does not, several of which seem spurious to me (e.g., a 'fallthrough' warning).

We need to agree on a single standard, one that's integrated into the Ant build.


> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-82) A large number of Java warnings due to unused vairables etc.

Posted by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. updated AVRO-82:
------------------------------------

    Attachment: AVRO-81.patch

I attempted to include checkstyle into ant builds. It can catch some more problems that are not caught by -Xlint or eclipse. But it left several problems uncaught. Speficifically, it does not catch unused local variables and missing parameters to genetic types. In some cases it does not catch all the unused imports.

I've attached the patch that sets up checkstyle. I have included the following checks to start with. We can add more tests as we move along.

The following checks found some violations

  - Tab characters in java files instead of spaces
  - Absence of a blank line at the end of the file
  - Wildcard imports
  - Redundant imports
  - Unused imports
  - Redundant modifiers (such as "public" for methods in interface)
  - Redundant throws (throw clause with an exception and its subclass for the same method or throw clause for a subclass of RuntimeException)
  - Array type style (use "boolean[] b" instead of "boolean b[]", for example)

The following check didn't find any

  -  Naming conventions for constants
  - Empty statements
  - Illegal instantiations (where factory should be used)
  - Simplify overly complex boolean expressions
  - Interface is type (Bloch Effective Java item 17)
  - Upper case L is used in long integer constants

The main reason for me create this JIRA is to avoid the large number of warnings I see in Eclipse. I'm forced to remember the number of warnings that the "clean" copy from svn generates so that I can ensure I don't introduce any more. Since we don't seem to have any simple alternative tool to catch all the warnings that eclipse generates, I guess have to just continue what I do.


> A large number of Java warnings due to unused vairables etc.
> ------------------------------------------------------------
>
>                 Key: AVRO-82
>                 URL: https://issues.apache.org/jira/browse/AVRO-82
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Thiruvalluvan M. G.
>            Assignee: Thiruvalluvan M. G.
>            Priority: Minor
>         Attachments: AVRO-82.patch, AVRO-82.patch
>
>
> I', creating this JIRA to submit a patch that fix the following:
>    - Unused imports
>    - Unused private fields, local variables
>    - Use of generic types without parameters
>    - Missing setialVersionUID for serializable classes
> There are more than 50 compiler warnings due to these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.