简体   繁体   中英

Intellij IDEA: False positives on build

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

I'm finding I get a lot of false positives when I build in Intellij, but only when there are other compilation errors - eg 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.)

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

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.

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?

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.)

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

Such issue can be caused by incorrect project configuration, like when some module source directories are added to the dependencies as library roots. If you can't find a problem yourself, either contact support or file a bug to YouTrack with a sample project attached and the steps to reproduce the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM