diff --git a/platform/platform-api/src/com/intellij/testFramework/FlakyTestLogger.kt b/platform/platform-api/src/com/intellij/testFramework/FlakyTestLogger.kt deleted file mode 100644 index 4fd00e5abf11..000000000000 --- a/platform/platform-api/src/com/intellij/testFramework/FlakyTestLogger.kt +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.testFramework - -import com.intellij.concurrency.ConcurrentCollectionFactory -import com.intellij.openapi.Disposable -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.util.Key -import org.jetbrains.annotations.TestOnly -import java.io.PrintWriter -import java.io.StringWriter - -@Deprecated("this class is here only for debugging a flaky test, it will be deleted as soon problem will be resolved") -class FlakyTestLogger(val enabled: Boolean) : Disposable { - - - data class Entry(val time: Long, val text: String) - - private val lists = ConcurrentCollectionFactory.createConcurrentIdentitySet>() - - private val lines = ThreadLocal.withInitial { ArrayList().also { lists.add(it) } } - - private fun add(str: String) { - lines.get().add(Entry(System.currentTimeMillis(), """${System.currentTimeMillis()} ${Thread.currentThread().name} $str""")) - } - - override fun dispose() { - lists.flatten().sortedBy { it.time }.forEach { println(it.text) } - } - - fun append(line: String) { - if (!enabled) return - add(line) - } - - fun append(exception: Exception) { - if (!enabled) return - val stringWriter = StringWriter() - exception.printStackTrace(PrintWriter(stringWriter)) - add(stringWriter.toString()) - } - - companion object { - - private val KEY = Key.create("LogAccumulator") - - @JvmStatic - fun get(): FlakyTestLogger? = TestModeFlags.get(KEY) - - @JvmStatic - fun force(): FlakyTestLogger = get() ?: FlakyTestLogger(false) - - @JvmStatic - fun isEnabled(): Boolean = TestModeFlags.get(KEY) != null - - @JvmStatic - @TestOnly - fun enable(disposer: Disposable) { - TestModeFlags.set(KEY, FlakyTestLogger(true).also { Disposer.register(disposer, it) }, disposer) - } - - } - -} \ No newline at end of file diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java index 023cd257e0a5..dd8a0745e155 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java @@ -20,7 +20,6 @@ import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; -import com.intellij.testFramework.FlakyTestLogger; import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xml.*; @@ -656,17 +655,7 @@ public abstract class DomInvocationHandler extends UserDataHolderBase implements @Nullable public final Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { - Invocation invocation = findInvocation(method); - Object r = invocation.invoke(this, args); - FlakyTestLogger log = FlakyTestLogger.get(); - if (log != null && method.getName().equals("exists")) { - log.append("Invocation: for '" + method + "' is '" + invocation + " of " + invocation.getClass() + "' handler = '" + this + - " of " + this.getClass() + "' r = " + r + " of " + ObjectUtils.doIfNotNull(r, Object::getClass)); - if (this instanceof IndexedElementInvocationHandler) { - log.append(((IndexedElementInvocationHandler)this).created); - } - } - return r; + return findInvocation(method).invoke(this, args); } catch (InvocationTargetException ex) { throw ex.getTargetException(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java index 35395eb688e7..1bf552afadb7 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java @@ -20,7 +20,6 @@ import com.intellij.openapi.util.Factory; import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; -import com.intellij.testFramework.FlakyTestLogger; import com.intellij.util.IncorrectOperationException; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.EvaluatedXmlName; @@ -39,8 +38,6 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler { private static final Logger LOG = Logger.getInstance(IndexedElementInvocationHandler.class); private final int myIndex; - public final Exception created; - public IndexedElementInvocationHandler(final EvaluatedXmlName tagName, final FixedChildDescriptionImpl description, final int index, @@ -48,8 +45,6 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler { final DomManagerImpl manager, @Nullable ElementStub stub) { super(description.getType(), strategy, tagName, description, manager, strategy.isPhysical(), stub); - created = FlakyTestLogger.isEnabled() ? new Exception( - "IndexedElementInvocationHandler(" + tagName + ", " + description + ", " + strategy + ", " + index + ", " + stub + ")") : null; myIndex = index; }