Intellij IDEA:构建时出现误报 [英] Intellij IDEA: False positives on build

查看:617
本文介绍了Intellij IDEA:构建时出现误报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Intellij IDEA来处理Java项目.

I'm using Intellij IDEA for work on a Java project.

我发现在Intellij中进行编译时会得到很多误报,但只有在出现其他编译错误时,例如我进行了更改,并期望出现许多编译错误,因此我努力寻找所有错误. (在这种情况下,我更改了一个广泛使用的接口,并希望编译器捕获错误,以便我知道要修复的实现.)除了其中一些预期的错误之外,Intellij还报告了数百个误报(这使得很难做到)找到真正的错误-目前,编译器每次仅显示一个真正的编译错误,因此我必须重新构建才能找到下一个错误...).这些错误的编译错误未突出显示-实际上,它们不是真正的编译错误. (如果我通过Maven进行编译,它们也不会出现.)

I'm finding I get a lot of false positives when I build in Intellij, but only when there are other compilation errors - e.g. I've made a change and expect a number of compile errors, so I build to find all the errors. (In this instance, I changed a widely used interface, and want the compiler to catch the errors so that I know which implementations to fix.) In addition to some of these expected errors, Intellij reports hundreds of false positives (which makes it difficult to find the real errors - at present the compiler is showing only one genuine compile error each time, so I have to rebuild to find the next error...). These false compile errors are not highlighted - indeed, they are not real compile errors. (Nor do they appear if I compile via Maven.)

最常见的错误是找不到符号类[X]",尽管该类通常位于同一项目中.

The most common error is 'cannot find symbol class [X]', despite that class often being in the same project.

我尝试过: -升级Intellij(从10.5.1到10.5.2到11.0.1) -使缓存无效并重建 -重新启动Intellij ...但都没有效果.

I've tried: - upgrading Intellij (from 10.5.1 to 10.5.2 to 11.0.1) - invalidating and rebuilding caches - restarting Intellij ...but all to no effect.

我已经搜索了 Intellij Bug跟踪板,但是在此未找到任何对此的引用,所以想知道这是否是用户错误(如果是,那么我需要更改哪些设置)?

I've searched the Intellij Bug Tracking board, but haven't found any reference to this there, so wondered whether this is user error (if so, what settings do I need to change)?

其他人有没有遇到过这样的事情?如果是这样,您如何解决它?

Has anyone else experienced anything like this? If so, how did you fix it?

推荐答案

这可能为时已晚,无法为您提供帮助,但也许会对其他人有所帮助.我有一个类似的问题. IntelliJ抱怨说找不到符号类,并且找不到的类在左上角有一个带有x的图标. x表示该类已从编译中排除. (我不知道那是怎么发生的.)

This is probably too late to help you, but maybe it will help somebody else. I had a similar problem. IntelliJ complained that it couldn't find a symbol class, and the class it couldn't find had an icon with a little x in the upper left hand corner. The x indicates that the class was excluded from compilation. (I have no idea how that happened.)

要包括排除的文件,请访问项目设置,例如,通过单击Ctrl + Alt + S.然后,您可以修改在项目设置"->编译器"->排除"下找到的列表,以重新包括排除的文件.

To include the excluded file, access project settings, e.g., by clicking Ctrl+Alt+S. Then you can modify the list found under Project Settings -> Compiler -> Excludes, to re-include the excluded file.

这篇关于Intellij IDEA:构建时出现误报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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