Community
Participate
Working Groups
I get a warning that a certain import statement is never used, even though a javadoc @link tag relies on that import.
Javadoc are not considered when performing the unused import diagnosis. You should fully qualify the type in the javadoc. Note that unused import diagnosis is a configurable setting you can turn off. Note that when the Java compiler performs, it will need to check that the extra import is resolvable, which means if you javadoc did become stale (extra import target got removed) then this extra import would prevent you from compiling your code, which doesn't need this import. Closing, won't change current behavior.
> this extra import would prevent you from compiling your code Thanks for pointing this out. In my universe, however, classes seldomly cease to exist, in particular not classes that were important enough to be mentioned in other packages' javadoc. So that isn't much of an issue to me. > You should fully qualify the type in the javadoc. Should I? I think this is a matter of style and taste. Personally, I don't like code clutter. In my thinking, Java package names usually qualify as code clutter. They are fine in import statements, but other than that, I try to avoid package names. I've noticed that this style of mine is supported by Eclipse extremely well, as far as Java code is concerned, but, alas, not well at all, as far as Javadoc is concerned. I'd really wish you had a different approach towards Javadoc, more consistent with what you do for code.