[jboss-as7-dev] Stricter checkstyle import check

Tomaž Cerar tomaz.cerar at gmail.com
Wed Feb 20 11:48:47 EST 2013


Hi,

For some time we considering enabling
UnusedImports<http://checkstyle.sourceforge.net/config_imports.html>but
in past checkstyle seemingly reported too much false positives for
imports that looked valid.

We are now enabling <https://github.com/jbossas/jboss-as/pull/4099>this
check in most strict way possible.

that means:
- it will complain when there are usual unused imports
- it will complain when there are imports that are used *only in
javadoc*comments.

the later is the controversial one, as many of us by default use imports
also for javadoc and some IDEs do that by default.

For example code like this:

import java.util.List;

...
/**
* @param a {@link List} for attributes
*/
..

would complain that java.util.List is not used in this class.
Proper javadoc in this case would be to use fully qualified class names
like:

/**
* @param a {@link java.util.List} for attributes
*/

this only applies if this import is only used in Javadoc not anywhere else.

This is a draconian change and will require some adjusting to but you can
set your IDE to always use FQN for classes in javadoc.
IDEA has support for this, for eclipse we have not found it yet...


One reason to be strict with javadocs is recent indecent [1] with product
recompile failure of CFNE after some package was renamed and import was
only in javadoc.

if full class name would be used Javadoc compilation would still work, but
javadoc reference would be wrong.



--
tomaz



[1] https://bugzilla.redhat.com/show_bug.cgi?id=912237
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-as7-dev/attachments/20130220/52fe5777/attachment-0001.html 


More information about the jboss-as7-dev mailing list