如何避免Eclipse在注释中放入类名时导入类,以便checkstyle稍后再投诉? [英] How to avoid Eclipse importing a class when putting the class name in the comments, so that checkstyle does not complain later?

查看:142
本文介绍了如何避免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?

推荐答案

不同意这是否是错误。 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天全站免登陆