如何避免Eclipse在类名称的注释中导入一个类,所以checkstyle后不会抱怨? [英] How to avoid Eclipse importing a class when putting the class name in the comments, so that checkstyle does not complain later?

查看:205
本文介绍了如何避免Eclipse在类名称的注释中导入一个类,所以checkstyle后不会抱怨?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我把类名放在方法或类的注释中,只是为了引用。但eclipse会自动导入并在文件中留下一个导入语句,导致未使用的导入checkstyle错误。有没有一些配置,我可以改变,以避免eclipse自动导入时,我在评论中键入类名?

Sometimes I put the class name in the comments of methods or class just for referencing. But eclipse does the import automatically and leaves an import statement in the file which causes "unused import" checkstyle errors later. Is there some configuration I can change to avoid eclipse automatically importing when I type the class name in the comments?

推荐答案

t同意这是否是一个错误。 Javadoc需要导入来创建适当的链接。我想说checkstyle应该提供一个选项(和Eclipse也许)改变警告。

People don't agree whether this is a bug or not. Javadoc needs the imports to create appropriate links. I'd say checkstyle should provide an option (and Eclipse maybe too) to change the warning.

有两个相关的错误报告:

There are two relevant bug reports:

  • eclipse
  • checkstyle (now fixed)

更新:上述错误已在checkstyle中修复。您知道可以选择配置行为

Update: The mentioned bug has been fixed in checkstyle. You know have the option to configure the behavior.

这篇关于如何避免Eclipse在类名称的注释中导入一个类,所以checkstyle后不会抱怨?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆