[JAVA] IntelliJ does not highlight the error files with wrong package names
Answered
Hi,
I have a file that has a wrong package name(i.e. does not have a corresponding directory). If I open the file, IntelliJ red marked the package on the top of the file, and states the package name is invalid.
But if the file is closed, there is no way to tell that the project has an error by just looking at the project view. Is there a way to highlight this type of errors on the project view?
Please sign in to leave a comment.
It's not a compiler error, therefore it's not highlighted when you build the project or when the file is closed.
Inspections work on the open files only for the performance reasons.
If you want to find all such problems at once, use Analyze | Inspect Code.
I was able to build the project with maven. Even if I have the file(Field.class) with errors open, it is not highlighted in the project tree.
It's not a compiler error, class will still compile with the invalid package.
Got it. Thanks for checking it out. Is there any way to highlight non-compiler error in the project tree as well?
https://youtrack.jetbrains.com/issue/IDEABKL-6215 :
> In a real codebase of a reasonable size, the majority of files have at least some inspection warnings. We see no benefit in displaying the information in the project view (even if we could accomplish this with reasonable performance, which we can't).