PreviousNextTracker indexSee it online !

(3/22) 2343472 - CheckStyle: update to work with checkstyle 4.4

Improved/fixed version of CheckStyle plugin. Changes made starting from release.

This updates the plugin to work with version 4.4 of the checkstyle library - the latest non-beta version.

The attached zip contains everything EXCEPT the checkstyle library jar - I can't attach it because it's too large for the tracker patch upload; you need to download the 4.4 version from here, and put checkstyle-all-4.4.jar in the /lib directory of the plugin sources:

Main changes made:

1. Modified to load some properties (though not tasks yet) from shared plugin build system

2. Upgraded to checkstyle 4.4 lib in build system and plugin dependency

3. Modified to work with checkstyle 4.4. The main problem was that checkstyle couldn't load dtds from inside its jar because it was using the thread context classloader to load resources, and it couldn't see them. Fixed by setting up thread context classloader when initialising Checker in CheckStyleThread.

4. Set a PropertyResolver on the Checker that returns empty strings so that checkstyle config xml files with '${...}' properties have a chance at working (assuming an empty string is actually a valid value where it's substituted). If in future we need real values we could use instead and let the values be set from an external properties file or in plugin options.

5. Rename plugin actions and menu text. Actions:
chkBuffer -> checkstyle.checkBuffer
chkAllBuffers -> checkstyle.checkAllBuffers

6. Allow setting project classpath to fix 'Unable to get class information for ...' errors in RedundantThrows checkstyle module and others.

Adding the compiled versions of the files being checked to the classloader fixes these errors - these checkstyle modules need to analyse the inheritance hierarchy, hence it needs the .class files.

Implemented by adding the files to the thread context classloader (see 3 above) running the Checker - using Checker's setClassloader() method does not work for some reason.

Plugin option dialog allows input of a regular jars-and-classdirs classpath, plus a list of dirs to be searched for .jar files.

Submitted memorius - 2008-11-25 - 13:40:50z Assigned nobody
Priority 5 Category None
Status Open Group None
Resolution None Visibility No



2008-11-25 - 13:40:50z

Full plugin sources after changes, except checkstyle jar (see above)

2009-04-24 - 14:30:09z

Missing file referenced by ant build script in previous attachment - expected to be in parent directory; you will need to set paths in it for your system