From 01f22368122dc14a60ea1df9ae18d23a5fa99fa1 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 23 Mar 2015 14:11:53 +0300 Subject: [PATCH] get PCE stackframe back to enable sensible stacktraces --- .../progress/impl/ProgressIndicatorTest.java | 13 +++++++------ .../progress/ProcessCanceledException.java | 15 ++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java index 1b3f39f2546d..ae68d2e17571 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java @@ -28,7 +28,10 @@ import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.wm.ex.ProgressIndicatorEx; import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; -import com.intellij.util.*; +import com.intellij.util.Alarm; +import com.intellij.util.Function; +import com.intellij.util.Processor; +import com.intellij.util.ThrowableRunnable; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.DoubleArrayList; import com.intellij.util.containers.Stack; @@ -46,18 +49,16 @@ import java.util.concurrent.atomic.AtomicBoolean; * @author yole */ public class ProgressIndicatorTest extends LightPlatformTestCase { - public void testCheckCanceledHasNoStackFrame() { - ProgressIndicatorBase pib = new ProgressIndicatorBase(); + public void testCheckCanceledHasStackFrame() { + ProgressIndicator pib = new ProgressIndicatorBase(); pib.cancel(); try { pib.checkCanceled(); fail("Please restore ProgressIndicatorBase.checkCanceled() check!"); } catch(ProcessCanceledException ex) { - boolean isInternal = SystemProperties.getBooleanProperty("idea.is.internal", false); - boolean isTest = SystemProperties.getBooleanProperty("idea.is.unit.test", false); boolean hasStackFrame = ex.getStackTrace().length != 0; - assertTrue("Should have no stackframe", (isInternal || isTest) == hasStackFrame); + assertTrue("Should have stackframe", hasStackFrame); } } diff --git a/platform/util/src/com/intellij/openapi/progress/ProcessCanceledException.java b/platform/util/src/com/intellij/openapi/progress/ProcessCanceledException.java index 0cdde2c48e87..2c6edf20432b 100644 --- a/platform/util/src/com/intellij/openapi/progress/ProcessCanceledException.java +++ b/platform/util/src/com/intellij/openapi/progress/ProcessCanceledException.java @@ -15,24 +15,13 @@ */ package com.intellij.openapi.progress; -import com.intellij.util.SystemProperties; +import org.jetbrains.annotations.NotNull; public class ProcessCanceledException extends RuntimeException { - private static final boolean ourHasStackTraces = SystemProperties.getBooleanProperty("idea.is.internal", false) || SystemProperties.getBooleanProperty("idea.is.unit.test", false); - public ProcessCanceledException() { } - public ProcessCanceledException(Throwable cause) { + public ProcessCanceledException(@NotNull Throwable cause) { super(cause); } - - @Override - public Throwable fillInStackTrace() { - if (ourHasStackTraces) return super.fillInStackTrace(); - // https://wikis.oracle.com/display/HotSpotInternals/PerformanceTechniques - // http://www.javaspecialists.eu/archive/Issue129.html - // http://java-performance.info/throwing-an-exception-in-java-is-very-slow/ - return this; - } }