diff --git a/source/com/intellij/slicer/SliceUtil.java b/source/com/intellij/slicer/SliceUtil.java index 02decf3999fa..5b7b234684d5 100644 --- a/source/com/intellij/slicer/SliceUtil.java +++ b/source/com/intellij/slicer/SliceUtil.java @@ -158,7 +158,9 @@ public class SliceUtil { for (final PsiMethod containingMethod : superMethods) { if (!MethodReferencesSearch.search(containingMethod).forEach(new Processor() { public boolean process(final PsiReference reference) { - if (!processed.add(reference)) return true; + synchronized (processed) { + if (!processed.add(reference)) return true; + } PsiElement element = reference.getElement().getParent(); if (!(element instanceof PsiCall)) return true; final PsiCall call = (PsiCall)element; diff --git a/util/src/com/intellij/util/CommonProcessors.java b/util/src/com/intellij/util/CommonProcessors.java index d85ed0e44c56..f188d0818181 100644 --- a/util/src/com/intellij/util/CommonProcessors.java +++ b/util/src/com/intellij/util/CommonProcessors.java @@ -43,7 +43,7 @@ public class CommonProcessors { return true; } - public T[] toArray(T[] a) { + public T[] toArray(T[] a) { return myCollection.toArray(a); } @@ -64,7 +64,7 @@ public class CommonProcessors { return true; } - public T[] toArray(T[] a) { + public T[] toArray(T[] a) { return myCollection.toArray(a); } @@ -85,7 +85,12 @@ public class CommonProcessors { } public boolean process(T t) { - return !processed.add(t) || myDelegate.process(t); + synchronized (processed) { + if (!processed.add(t)) { + return true; + } + } + return myDelegate.process(t); } }