diff --git a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/util/KtTestUtil.java b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/util/KtTestUtil.java index a38c603329d..eb922fbd489 100644 --- a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/util/KtTestUtil.java +++ b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/util/KtTestUtil.java @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.psi.KtFile; import org.jetbrains.kotlin.test.KtAssert; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; +import org.jetbrains.kotlin.utils.ExceptionUtilsKt; import java.io.File; import java.io.FileNotFoundException; @@ -94,16 +95,16 @@ public class KtTestUtil { * This clarifies the exception by showing the full path. */ String messageWithFullPath = file.getAbsolutePath() + " (No such file or directory)"; - throw new RuntimeException( - new IOException( - "Ensure you have your 'Working Directory' configured correctly as the root " + - "Kotlin project directory in your test configuration\n\t" + - messageWithFullPath, - fileNotFoundException - ) + throw ExceptionUtilsKt.rethrow( + new IOException( + "Ensure you have your 'Working Directory' configured correctly as the root " + + "Kotlin project directory in your test configuration\n\t" + + messageWithFullPath, + fileNotFoundException + ) ); } catch (IOException e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/AbstractPseudocodeTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/AbstractPseudocodeTest.java index c63c8276588..ea2aea771d1 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/AbstractPseudocodeTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/AbstractPseudocodeTest.java @@ -41,6 +41,7 @@ import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.test.ConfigurationKind; import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.KotlinTestWithEnvironmentManagement; +import org.jetbrains.kotlin.utils.ExceptionUtilsKt; import java.io.File; import java.io.IOException; @@ -53,7 +54,7 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironmentMa try { doTestWithEnvironment(fileName, createEnvironmentWithMockJdk(ConfigurationKind.NO_KOTLIN_REFLECT)); } catch (Exception e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } } @@ -61,7 +62,7 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironmentMa try { doTestWithEnvironment(fileName, createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY)); } catch (Exception e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 9f6e4f125ce..0986eb624e8 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -526,7 +526,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest srcFiles = TestFiles.createTestFiles( @@ -387,7 +388,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir { usePsiClassFilesReading(), useJavacWrapper(), withForeignAnnotations(), explicitLanguageVersionSettings, getExtraClasspath(), this::configureEnvironment); } catch (IOException e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index 82be53d66c6..a94e807178c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -554,7 +554,7 @@ public class KotlinTestUtils { try { FileUtil.writeToFile(testDataFile, newText); } catch (IOException ioException) { - throw new RuntimeException(ioException); + throw ExceptionUtilsKt.rethrow(e); } } } @@ -585,7 +585,7 @@ public class KotlinTestUtils { try { FileUtil.writeToFile(testDataFile, newText); } catch (IOException e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } } } diff --git a/compiler/tests/org/jetbrains/kotlin/modules/xml/AbstractModuleXmlParserTest.java b/compiler/tests/org/jetbrains/kotlin/modules/xml/AbstractModuleXmlParserTest.java index a7f8daddc13..e080ef0802d 100644 --- a/compiler/tests/org/jetbrains/kotlin/modules/xml/AbstractModuleXmlParserTest.java +++ b/compiler/tests/org/jetbrains/kotlin/modules/xml/AbstractModuleXmlParserTest.java @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.cli.common.modules.ModuleChunk; import org.jetbrains.kotlin.cli.common.modules.ModuleXmlParser; import org.jetbrains.kotlin.modules.Module; import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.utils.ExceptionUtilsKt; import java.io.File; import java.io.IOException; @@ -69,7 +70,7 @@ public abstract class AbstractModuleXmlParserTest extends TestCase { FileUtil.writeToFile(txtFile, actual); } catch (IOException e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } fail("Expected data file does not exist. A new file created: " + txtFile); } diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/AbstractParsingTest.java b/compiler/tests/org/jetbrains/kotlin/parsing/AbstractParsingTest.java index c032ea1f773..cdcf2316dba 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/AbstractParsingTest.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/AbstractParsingTest.java @@ -30,6 +30,7 @@ import org.jetbrains.kotlin.TestsCompilerError; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.test.testFramework.KtParsingTestCase; import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.utils.ExceptionUtilsKt; import java.lang.annotation.Annotation; import java.lang.reflect.Method; @@ -98,7 +99,7 @@ public abstract class AbstractParsingTest extends KtParsingTestCase { try { doBaseTestImpl(filePath, fileType, contentFilter); } catch (Exception e) { - throw new RuntimeException(e); + throw ExceptionUtilsKt.rethrow(e); } }