Why does Eclipse add an import for the target class of a Javadoc @see comment?
If you run this through findbugs or PMD they complain that its an unused import.
So which is correct? Personally I can't see why eclipse wants to import it.
import java.util.List;
/**
* @see List
*/
The same is true for 'link'
import java.util.List;
/**
* {@link List}
*/
Does any have any ideas why?
The important thing to understand about import statements are that they are simply a convenience mechanism for the developer to avoid having to use the Fully Qualified Name (FQN) for a Type
everywhere. For example, importing java.util.List
will let you refer to it by simply using the simple name List
as opposed to using java.util.List
everywhere.
Imports have no effect on the efficiency or size of the generated bytecode since their use is as explained above and they do not cause any classes to be 'linked' or anything like that with your class.
In the case of the JavaDoc comments, if you use the FQN , Eclipse wouldn't need to import in order to resolve the Type
reference. As it is, you're using the simple name which is ambiguous so Eclipse imports the appropriate Type
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With