diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index eec201a44892..5e4633b93d9d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -336,7 +336,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application return false; } } - ApplicationManager.getApplication().runWriteAction(new Runnable() { + runWriteAction(new Runnable() { @Override public void run() { Disposer.dispose(ApplicationImpl.this); @@ -636,8 +636,9 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application assertIsDispatchThread(); if (myExceptionalThreadWithReadAccessRunnable != null || - ApplicationManager.getApplication().isUnitTestMode() || - ApplicationManager.getApplication().isHeadlessEnvironment()) { + isUnitTestMode() || + isHeadlessEnvironment() + ) { try { ProgressManager.getInstance().runProcess(process, new EmptyProgressIndicator()); } @@ -653,7 +654,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application try { myExceptionalThreadWithReadAccessRunnable = process; - final boolean[] threadStarted = {false}; + final AtomicBoolean threadStarted = new AtomicBoolean(); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override @@ -688,13 +689,13 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application } } }); - threadStarted[0] = true; + threadStarted.set(true); } }); progress.startBlocking(); - LOG.assertTrue(threadStarted[0]); + LOG.assertTrue(threadStarted.get()); LOG.assertTrue(!progress.isRunning()); } finally { @@ -801,7 +802,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application * Note: there are possible scenarios when we get a quit notification at a moment when another * quit message is shown. In that case, showing multiple messages sounds contra-intuitive as well */ - private volatile static boolean exiting = false; + private static volatile boolean exiting = false; public void exit(final boolean force, final boolean allowListenersToCancel, final boolean restart) { @@ -1109,7 +1110,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application assertIsDispatchThread("Access is allowed from event dispatch thread only."); } - private static void assertIsDispatchThread(String message) { + private static void assertIsDispatchThread(@NotNull String message) { final Thread currentThread = Thread.currentThread(); if (ourDispatchThread == currentThread) return;