- How can I be sure that this checkstyle is sun's *official* checkstyle for the java language ? I did found lots of info about the sun checkstyle, but none of them are presented in some useable format to plug into a checkstyle plugin (I'm not going to manually verify it) .
- In every class I have multiple warnings. This checkstyle is VERY strict. For example: it nags about blank lines or spaces in my javadoc, line length is 80 chars, I have to put 'final' for every method parameter . Ok the last one I can still coop with, you do not reuse method params. But my normal checkstyle guidelines only give a checkstyle error when I'm actually doing that (and thus not require to put all of them final) . Now, is it allowed to ignore such warnings ? ...
Originally posted by Koen Serneels:
- How can I be sure that this checkstyle is sun's *official* checkstyle for the java language ? I did found lots of info about the sun checkstyle, but none of them are presented in some useable format to plug into a checkstyle plugin (I'm not going to manually verify it)
I think you've answered your own question here. Sun doesn't have any offical checkstyle config file, the only document they have is: Code Conventions for the JavaTM Programming Language which you've already read. So if you want to be sure you are going to have to manually verify your code.
Lint, checkstyle, and the coding conventions are just guidelines--use your judgement.
I used checkstyle, too. Unfortunately I made the mistake of waiting until I was almost done with the project. The first time I ran it I had 1500 errors! I wrote some code to traverse the directories and fix simple problems like trailing spaces and tabs. But some of the checks I thought were unnecessary so I commented them out. You'll see at the top of sun_checks.xml it says:
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
The modules I commented out were:
I figured these fell under the 'best practices' and probably weren't required. But I didn't look into too much because by this time I was tired of working on the assignment.