I am developing a plugin where I need to instrument some classes after they are compiled.
What I have done so far:
1. registered my +ClassInstrumentingCompiler +with CompilerManager
2. in ClassInstrumentingCompiler.+getProcessingItems +I return items (files) which need to be instrumented with corresponding ValidityState
2. in ClassInstrumentingCompiler.process I instrument my classes, but before I need to recompile some of them (basically to get rid of previous intrumentation if some meta data has been changed). The problem is in that step. Inside the process I just call:
But it complains that it needs to be called from inside EDT. I wonder why? I am already in the compiler thread, am I not?
Anyway if I put it inside EDT by calling ApplicationManager.invokeAndWait (I can't really use invokeLater, because this whole chain of compilers will be broken?) then it seems that
is running asynchronously in another thread (not in EDT). Here is the execution sequence how it seems to be working:
How I expect it to work:
I am a little bit confused. How to implement this properly?