Hi Jack,
You might want to do a quick check on the sun_checks.xml file. The first few lines should be a large block similar to:
(Note: it does have "some best practices" so there are some things that it will report that are just best practices - not actually documented in the listing above)
Of the errors you got, I think most of them were correct. It is just the errors for SunFactory line 1 that seemed odd. What is the first line of this file?
I think you have copied your source file to the same directory as checkstyle, therefore it cannot find your package documentation file. That is a reasonable error.
OK - this might cause issues with some compilers (it used to with some old Microsoft Pascal and C compilers). If you did not end the file with a blank line, the compiler ignored the last line, which often caused the compilation to fail. You will see a lot of people still putting things like "//// end" at the end of their file - it makes printouts easier to read, and gives bad compilers something to swallow.
Not really a problem, but it is nice to add a line just to ensure you dont get caught if you use a non standard java compiler.
I am guessing that you only have static methods in this class? And you dont have an explicit constructor? In which case, this is correct:
you should have a private constructor.
Yes, that is in the Sun code conventions
And are you missing a javadoc comment there
Yes, that is in the Sun code conventions
You should not have lines longer than 80 characters. I think this is a "best coding practice". The Sun code conventions do explain how to wrap lines, but I don't think they give an explicit maximum size of lines. I would have to check. But this is definately something you want to look at.
And are you missing a javadoc comment there
Again, this is probably because you have copied one source file to the checkstyle directory, and checkstyle cannot find the other class to ensure you are using it correctly.
For what its worth, here is my run line:
Of course, typing huge command lines like that are not very nice, so I created a script (batch file for people on Microsoft OSes) to give me that command line: all I have to do is provide the name(s) of the file(s) to be verified and it does the rest.
Can anyone help? I'm getting very tired of checkstyle; I should have done the work by hand given the amount of time I've wasted on this.
I can understand your frustration. The nice thing is that once you have this set up the way you like it, it will just work for all your other files.
Regards, Andrew