Performing write operations inside a ClassPostProcessingCompiler

Hi,

I'm adding a ClassPostProcessingCompiler which generates a file during build in the output directory. But the Application.isWriteAccessAllowed() method returns false - which is kind of surprising since by definition a compiler "writes" things :)

I've tried to wrap it in Application.runWriteAction but a log statement is issued saying "Write access is allowed from event dispatch thread only" is output to the log.

Am I doing something wrong here?

3 comments
Comment actions Permalink

From http://confluence.jetbrains.net/display/IDEADEV/IntelliJ+IDEA+Architectural+Overview: "the data structures of IntelliJ IDEA are covered by a single "multiple readers / single writer" lock."  AFAIU you don't need to use WriteActions here as long as you're dealing with files only, see org.jetbrains.idea.maven.compiler.MavenResourceCompiler#process

0
Comment actions Permalink

Hello Arik,

The compiler is expected to operate on the level of java.io.Files rather
than the VFS. That doesn't require a write action.

I'm adding a ClassPostProcessingCompiler which generates a file during
build in the output directory. But the
Application.isWriteAccessAllowed() method returns false - which is
kind of surprising since by definition a compiler "writes" things


I've tried to wrap it in Application.runWriteAction but a log
statement is issued saying "Write access is allowed from event
dispatch thread only" is output to the log.

Am I doing something wrong here?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Thanks, that clears it :)

0

Please sign in to leave a comment.