Looking for debug/diagnosing guidance - IntelliJ Editor Class Reference Errors

Answered

Hello

I'm looking for guidance on how to debug or diagnose the issue vaguely-described below. I'm not looking for someone to solve it for us, as I'd expect that would be time consuming (unless someone off the top of their heads knows of something that can be causing this.) As it stands, I can't even hazard a guess as to what's causing this issue (or issues?,) as it seems very random, and we don't know how to reproduce it.

Me and a couple of others on our development team have been running into issues recently where IntelliJ complains about certain classes not being found, even though they do exist and should be visible/accessible to the class exhibiting the errors. For example, IntelliJ may complain that a superclass can't be found, even though we can command-click into this superclass through the editor. The gutter in the superclass will not show the icons that let us see what classes extend or implement/override (abstract) methods. Similarly the gutter in the extending class won't show icons that let us traverse up to the parent. It's like the two classes can't see each other at all, despite existing in the same package. Similarly, classes referenced when declaring members sometimes can't be found, either. Classes referenced in method parameters sometimes can't be found. Things like this. This can also happen in unmodified code. I.e. code that has been committed into git and has been compiled regularly through a CI build. Even untouched by us, sometimes some classes can suddenly start exhibiting these issues. This leads me to believe it's environmental somehow and we're all doing something -- I don't know what -- to cause these issues.

We work within a gradle project. Through the terminal we are able to gradle compile our project without any issues.

Typically we'll try numerous things to try to resolve this, including

- Performing a gradle clean (rarely works)
- Reloading gradle projects (rarely works)
- Disabling the gradle plugin, restarting, re-enabling it, and restarting again (which has "fixed" this issue for me in the past.)
- Invalidating caches (and selecting all optional tasks, such as clearing file system cache and local history) (sometimes works. See note below.)
- Checking out and rebuilding the project in a brand new clean directory (sometimes works.)

Sometimes these errors go away, but they can just as easily return for seemingly no reason whatsoever. Sometimes a single 'invalidate caches' fails to resolve it, but running it two or three times "fixes" the issue. Often these issues return within a day or two. It's not apparent what the issue is.

We use a mix of recent IntelliJ community and ultimate editions.

What logs would we want to look at to diagnose this? What type of logging/exceptions would we want to look for in the logs? Any guidance would be much appreciated. It'd be great to get to the root of this issue, or at least narrow our focus into a specific area.

Thanks,
-- Cam

0
2 comments

Please check with https://www.jetbrains.com/idea/nextversion/. If the issue persists, file a bug at https://youtrack.jetbrains.com/newIssue?project=IDEA with the logs attached via Help | Collect Logs and Diagnostic Data.

0

If the project can be built from the IDE at the moment when you have the issue (File | Build | Rebuild project) this is likely a indexes/caches problem. To diagnose indexing/caching problems you could try using the 2021.3 EAP version from https://www.jetbrains.com/idea/nextversion/

With this version please add

idea.is.internal=true

line into Help | Edit Custom Properties file and 

-Dlog.index.vfs.events=true 

into idea.vmoptions (use Help | Edit Custom VM Options action). Restart the IDE.

After this there will appear File | Cache Recovery menu which should help to diagnose and fix the indexing/caching problem

If last version suggested by Serge does not help, please perform the above steps and file an issue to YouTrack with the IDE logs attached after issue happens and please advise it guided caches recovery helped you and on which step. Thank you.

0

Please sign in to leave a comment.