From 502cbbdfd65093df77027a4db0dcecd5af1b5366 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 12 Jul 2010 16:59:28 +0400 Subject: [PATCH 1/3] do not invoke later in tests --- .../intellij/codeInsight/daemon/impl/PsiChangeHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java index a477b2430515..afc877a3f6dd 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java @@ -19,6 +19,7 @@ package com.intellij.codeInsight.daemon.impl; import com.intellij.codeInsight.daemon.ChangeLocalityDetector; import com.intellij.codeInspection.SuppressionUtil; import com.intellij.openapi.Disposable; +import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.editor.Document; @@ -166,8 +167,9 @@ public class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable private void updateByChange(PsiElement child, final boolean whitespaceOptimizationAllowed) { final Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor(); - if (editor != null) { - ApplicationManager.getApplication().invokeLater(new Runnable() { + Application application = ApplicationManager.getApplication(); + if (editor != null && !application.isUnitTestMode()) { + application.invokeLater(new Runnable() { public void run() { if (myProject.isDisposed()) return; EditorMarkupModel markupModel = (EditorMarkupModel)editor.getMarkupModel(); From dad96525be21cd9781e9e12eb8cd6674fabcb4bb Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 12 Jul 2010 19:03:12 +0400 Subject: [PATCH 2/3] cleanup --- .../codeInsight/intention/EmptyIntentionAction.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java index 44668a2ef223..8808e65288f1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java @@ -32,7 +32,7 @@ import java.util.List; public final class EmptyIntentionAction implements IntentionAction{ private final String myName; - public EmptyIntentionAction(final String name) { + public EmptyIntentionAction(@NotNull String name) { myName = name; } @@ -63,15 +63,11 @@ public final class EmptyIntentionAction implements IntentionAction{ final EmptyIntentionAction that = (EmptyIntentionAction)o; - if (myName != null ? !myName.equals(that.myName) : that.myName != null) return false; - - return true; + return myName.equals(that.myName); } public int hashCode() { - int result; - result = (myName != null ? myName.hashCode() : 0); - return result; + return myName.hashCode(); } // used by TeamCity plugin From 48f195fb06da2a924ab205c64c8e5deed3304f14 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 13 Jul 2010 11:56:46 +0400 Subject: [PATCH 3/3] removed memory stress instructions --- .../intellij/util/containers/WeaksTestCase.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/platform/util/testSrc/com/intellij/util/containers/WeaksTestCase.java b/platform/util/testSrc/com/intellij/util/containers/WeaksTestCase.java index fb11d803bc07..21924d11e03f 100644 --- a/platform/util/testSrc/com/intellij/util/containers/WeaksTestCase.java +++ b/platform/util/testSrc/com/intellij/util/containers/WeaksTestCase.java @@ -45,24 +45,12 @@ public abstract class WeaksTestCase extends TestCase { protected static void gc() { System.gc(); - try { - List list = new ArrayList(); - while (Runtime.getRuntime().freeMemory() > 100000) { - list.add(new byte[1000]); - } - - System.gc(); - list = null; - } - catch (OutOfMemoryError e) { - // ignore - } System.gc(); WeakReference weakReference = new WeakReference(new Object()); do { System.gc(); - } + } while (weakReference.get() != null); }