Read-only method access from compiler plugins?

When doing a PsiManager.findFile() call in a compiler plugin, I get the following error:

It doesn't seem to cause any adverse side effects (my code runs fine etc.), but obviously I don't want to have an error dialog with stack trace pop up left and right. From my (very sketchy) understanding of what's going on, IDEA only allows read access from the Swing event thread and from designated read-only actions. Based on the stack, it looks like the compiler plugins run in a different thread, even though they're kicked off by the Swing event thread. What does this mean in terms of read-only access to IDEA data structures from compiler plugins? Are we going to have to create actions for all the things that our code will need to do, and then trigger the action from code or something? I'd expect that the compiler thread would also be a safe one to execute read operations from.


Please sign in to leave a comment.