[jboss-as7-dev] Stricter checkstyle import check

David M. Lloyd david.lloyd at redhat.com
Wed Feb 20 12:02:31 EST 2013


I don't like it, but I guess the reasoning is sound.

On 02/20/2013 10:48 AM, Tomaž Cerar wrote:
> 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
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>


-- 
- DML


More information about the jboss-as7-dev mailing list