[Test] Use rethrow for checked exception in java-written tests

In 9b5a9ccb `throws Exception` was removed from java test sources and
  all checked exceptions were wrapped with `RuntimeException`

But it was forgotten that there is a `rethrow` utility, which doesn't
  wrap exception but makes the javac happy at the same time
This commit is contained in:
Dmitriy Novozhilov
2024-03-14 10:02:48 +02:00
committed by Space Team
parent 09c27d78b8
commit f288163cbc
9 changed files with 32 additions and 25 deletions
@@ -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);
}
@@ -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);
}
}