CompilerManager.executeTask behavior change in 7.0?

I'm seeing context.getProgressIndicator() return null for tasks executed by CompilerManager.executeTask. I don't see any documentation for why this would happen... it is not null when executed as a pre-compile step. This didn't happen in 6.x.

Any ideas?

.execute(]]>:160)
at com.intellij.compiler.impl.CompileDriver$20$1.run(CompileDriver.java:9)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:6)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:52)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:39)
at com.intellij.compiler.impl.CompileDriver$20.run(CompileDriver.java:5)
at com.intellij.openapi.application.impl.ApplicationImpl$5.run(ApplicationImpl.java:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:3)

0
Avatar
Permanently deleted user

Hello Keith,

This method may return null or not, depending on the execution context (for
example, background or foreground compile). You should add a check for null.

I'm seeing context.getProgressIndicator() return null for tasks
executed by CompilerManager.executeTask. I don't see any documentation
for why this would happen... it is not null when executed as a
pre-compile step. This didn't happen in 6.x.

Any ideas?

<MyTask>.execute(<MyTask.java>:160)
at
com.intellij.compiler.impl.CompileDriver$20$1.run(CompileDriver.java:9
)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressM
anagerImpl.java:6)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessU
nderProgress(ProgressManagerImpl.java:52)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(Prog
ressManagerImpl.java:39)
at
com.intellij.compiler.impl.CompileDriver$20.run(CompileDriver.java:5)
at
com.intellij.openapi.application.impl.ApplicationImpl$5.run(Applicatio
nImpl.java:8)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441
)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
tor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
java:907)
at java.lang.Thread.run(Thread.java:619)
at
com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(Applicat
ionImpl.java:3)

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


0
Avatar
Permanently deleted user

OK.... can I cache the result of getProgressIndicator? Or could it return null one moment and nonnull the next? I don't understand how it could be null - users can still cancel background processes, no? Anyway I'll try this on monday.

0
Avatar
Permanently deleted user

I changed the code to handle null - now I see NPE within CompilerTask.

java.lang.NullPointerException
at com.intellij.compiler.progress.CompilerTask.d(CompilerTask.java:117)
at com.intellij.compiler.progress.CompilerTask.addMessage(CompilerTask.java:115)
at com.intellij.compiler.impl.CompileContextImpl.addMessage(CompileContextImpl.java:1)
at com.intellij.compiler.impl.CompileContextImpl.addMessage(CompileContextImpl.java:38)

[[ our code ]]

at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:6)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:52)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:39)
at com.intellij.compiler.impl.CompileDriver$20.run(CompileDriver.java:5)
at com.intellij.openapi.application.impl.ApplicationImpl$5.run(ApplicationImpl.java:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:3)

0
Avatar
Permanently deleted user

(This is for build 7573)

0

请先登录再写评论。