Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 914
amaidment Avatar asked Jan 12 '12 11:01

amaidment


People also ask

What is the difference between build and rebuild in IntelliJ?

Basically, "Build Artifact" is a conditional build, meaning it will only build if there is any modified code. If you haven't changed anything, it won't do anything. "Rebuild Artifact", however, will force a build from scratch no matter if there are code changes or not.

How do I show complier errors in IntelliJ?

Show all errors in one place:The Problems tool window appears if the Make project automatically option is enabled in the Compiler settings. It shows a list of problems that were detected on project compilation.

How do I enable build automatically in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Compiler. On the Compiler page, select Build project automatically. Now when you make changes in the class files, IntelliJ IDEA automatically performs the incremental build of the project.


1 Answers

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

like image 109
kc2001 Avatar answered Sep 19 '22 12:09

kc2001