From d11344ce2e11aa5547085945357c24fe10d2477d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Sch=C3=A4fer?= Date: Fri, 5 Jul 2019 15:24:54 +0200 Subject: [PATCH] Add more tests for -Xassertions=jvm corner cases --- ...ssertionsEnabledBeforeClassInitializers.kt | 54 +++++++++++++++++++ .../codegen/box/assert/jvm/classAssertions.kt | 34 ++++++++++++ .../assert/jvm/classAssertionsForCompanion.kt | 40 ++++++++++++++ .../jvm/classAssertionsForInnerClasses.kt | 41 ++++++++++++++ .../jvm/classAssertionsForLocalClasses.kt | 43 +++++++++++++++ .../jvm/classAssertionsForNestedClasses.kt | 47 ++++++++++++++++ .../box/assert/jvm/lambdaNotEvaluated.kt | 51 ++++++++++++++++++ .../jvm/noUnnecessaryClassInitialization.kt | 26 +++++++++ .../assert/jvmCrossinlineAssertInLambda.kt | 3 +- .../bytecodeText/assert/jvmNestedClass.kt | 23 ++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 40 ++++++++++++++ .../codegen/BytecodeTextTestGenerated.java | 5 ++ .../LightAnalysisModeTestGenerated.java | 40 ++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 40 ++++++++++++++ .../ir/IrBytecodeTextTestGenerated.java | 5 ++ 15 files changed, 491 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/classAssertions.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt create mode 100644 compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt create mode 100644 compiler/testData/codegen/bytecodeText/assert/jvmNestedClass.kt diff --git a/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt b/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt new file mode 100644 index 00000000000..4311b1ab1b2 --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt @@ -0,0 +1,54 @@ +// IGNORE_BACKEND: JVM_IR +// TARGET_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +// Assertions which run before the class initializer are always checked + +package initializerAssertionsEnabled + +class Checker { + fun test() = Baz.testAsserts() +} + +open class Bar { + companion object { + val barAssertionThrown = try { + Baz().assertFalse() + false + } catch(error: java.lang.AssertionError) { + true + } + } +} + +class Baz : Bar() { + fun assertFalse() = assert(false) + + companion object { + val bazAssertionThrown = try { + Baz().assertFalse() + false + } catch(error: java.lang.AssertionError) { + true + } + + fun testAsserts(): String { + if (!barAssertionThrown) return "Fail 1" + if (bazAssertionThrown) return "Fail 2" + return "OK" + } + } +} + +class Dummy + +fun disableAssertions(): Checker { + val loader = Dummy::class.java.classLoader + loader.setPackageAssertionStatus("initializerAssertionsEnabled", false) + return loader.loadClass("initializerAssertionsEnabled.Checker").newInstance() as Checker +} + +fun box(): String { + return disableAssertions().test() +} diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertions.kt b/compiler/testData/codegen/box/assert/jvm/classAssertions.kt new file mode 100644 index 00000000000..0bcb3914bcd --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/classAssertions.kt @@ -0,0 +1,34 @@ +// TARGET_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +package classAssertions + +class ShouldBeEnabled { + fun checkTrue(): Boolean { + var hit = false + assert({ hit = true; true }()) + return hit + } +} + +class ShouldBeDisabled { + fun checkFalse(): Boolean { + var hit = false + assert({ hit = true; true }()) + return hit + } +} + +class Dummy + +fun box(): String { + val loader = Dummy::class.java.classLoader + loader.setClassAssertionStatus("classAssertions.ShouldBeEnabled", true) + loader.setClassAssertionStatus("classAssertions.ShouldBeDisabled", false) + val c1 = loader.loadClass("classAssertions.ShouldBeEnabled").newInstance() as ShouldBeEnabled + val c2 = loader.loadClass("classAssertions.ShouldBeDisabled").newInstance() as ShouldBeDisabled + if (!c1.checkTrue()) return "FAIL 0" + if (c2.checkFalse()) return "FAIL 1" + return "OK" +} diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt new file mode 100644 index 00000000000..0b765861c84 --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt @@ -0,0 +1,40 @@ +// TARGET_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +package classAssertions + +class ShouldBeEnabled { + fun checkTrue() = ShouldBeEnabled.hit + + companion object { + var hit = false + init { + assert({ hit = true; true }()) + } + } +} + +class ShouldBeDisabled { + fun checkFalse() = ShouldBeDisabled.hit + + companion object { + var hit = false + init { + assert({ hit = true; true }()) + } + } +} + +class Dummy + +fun box(): String { + val loader = Dummy::class.java.classLoader + loader.setClassAssertionStatus("classAssertions.ShouldBeEnabled", true) + loader.setClassAssertionStatus("classAssertions.ShouldBeDisabled", false) + val c1 = loader.loadClass("classAssertions.ShouldBeEnabled").newInstance() as ShouldBeEnabled + val c2 = loader.loadClass("classAssertions.ShouldBeDisabled").newInstance() as ShouldBeDisabled + if (!c1.checkTrue()) return "FAIL 0" + if (c2.checkFalse()) return "FAIL 1" + return "OK" +} diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt new file mode 100644 index 00000000000..6f53cdb07b3 --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt @@ -0,0 +1,41 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +package classAssertions + +class ShouldBeEnabled { + fun checkTrue() = Inner().hit + + inner class Inner { + var hit = false + init { + assert({ hit = true; true }()) + } + } +} + +class ShouldBeDisabled { + fun checkFalse() = Inner().hit + + inner class Inner { + var hit = false + init { + assert({ hit = true; true }()) + } + } +} + +class Dummy + +fun box(): String { + val loader = Dummy::class.java.classLoader + loader.setClassAssertionStatus("classAssertions.ShouldBeEnabled", true) + loader.setClassAssertionStatus("classAssertions.ShouldBeDisabled", false) + val c1 = loader.loadClass("classAssertions.ShouldBeEnabled").newInstance() as ShouldBeEnabled + val c2 = loader.loadClass("classAssertions.ShouldBeDisabled").newInstance() as ShouldBeDisabled + if (!c1.checkTrue()) return "FAIL 0" + if (c2.checkFalse()) return "FAIL 1" + return "OK" +} diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt new file mode 100644 index 00000000000..96366cc33bb --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt @@ -0,0 +1,43 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +package classAssertions + +class ShouldBeEnabled { + fun checkTrue(): Boolean { + class Local { + var hit = false + init { + assert({ hit = true; true}()) + } + } + return Local().hit + } +} + +class ShouldBeDisabled { + fun checkFalse(): Boolean { + class Local { + var hit = false + init { + assert({ hit = true; true}()) + } + } + return Local().hit + } +} + +class Dummy + +fun box(): String { + val loader = Dummy::class.java.classLoader + loader.setClassAssertionStatus("classAssertions.ShouldBeEnabled", true) + loader.setClassAssertionStatus("classAssertions.ShouldBeDisabled", false) + val c1 = loader.loadClass("classAssertions.ShouldBeEnabled").newInstance() as ShouldBeEnabled + val c2 = loader.loadClass("classAssertions.ShouldBeDisabled").newInstance() as ShouldBeDisabled + if (!c1.checkTrue()) return "FAIL 0" + if (c2.checkFalse()) return "FAIL 1" + return "OK" +} diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt new file mode 100644 index 00000000000..74963866c2e --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt @@ -0,0 +1,47 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +package classAssertions + +class ShouldBeEnabled { + fun checkTrue() = A.B().hit + + class A { + class B { + var hit = false + + init { + assert({ hit = true; true }()) + } + } + } +} + +class ShouldBeDisabled { + fun checkFalse() = A.B().hit + + class A { + class B { + var hit = false + + init { + assert({ hit = true; true }()) + } + } + } +} + +class Dummy + +fun box(): String { + val loader = Dummy::class.java.classLoader + loader.setClassAssertionStatus("classAssertions.ShouldBeEnabled", true) + loader.setClassAssertionStatus("classAssertions.ShouldBeDisabled", false) + val c1 = loader.loadClass("classAssertions.ShouldBeEnabled").newInstance() as ShouldBeEnabled + val c2 = loader.loadClass("classAssertions.ShouldBeDisabled").newInstance() as ShouldBeDisabled + if (!c1.checkTrue()) return "FAIL 0" + if (c2.checkFalse()) return "FAIL 1" + return "OK" +} diff --git a/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt b/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt new file mode 100644 index 00000000000..38701ae27a5 --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt @@ -0,0 +1,51 @@ +// IGNORE_BACKEND: JVM_IR +// TARGET_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +// If assertions are disabled, neither argument to assert should be evaluated. +// If assertions are enabled, both arguments should be evaluate to values before +// checking the assertion. + +package assertions + +interface Checker { + fun check(): Boolean +} + +class Checker1 : Checker { + override fun check(): Boolean { + var result = true + assert(true, { + result = false + { "Assertion failure" } + }()) + return result + } +} + +class Checker2 : Checker { + override fun check(): Boolean { + var result = true + assert(true, { + result = false + { "Assertion failure" } + }()) + return result + } +} + +fun checkerWithAssertions(enabled: Boolean): Checker { + val loader = Checker::class.java.classLoader + loader.setPackageAssertionStatus("assertions", enabled) + val c = loader.loadClass(if (enabled) "assertions.Checker1" else "assertions.Checker2") + return c.newInstance() as Checker +} + +fun box(): String { + var c = checkerWithAssertions(true) + if (c.check()) return "Fail 1" + c = checkerWithAssertions(false) + if (!c.check()) return "Fail 2" + return "OK" +} diff --git a/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt b/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt new file mode 100644 index 00000000000..f7bc41fe918 --- /dev/null +++ b/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt @@ -0,0 +1,26 @@ +// TARGET_BACKEND: JVM +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// WITH_RUNTIME + +// Reusing the $assertionsDisabled field in the Outer class might seem like a good idea, +// but it would result in an error in this case. +class Outer { + companion object { + init { error("") } + } + + init { assert(true) } + + class Inner { + init { assert(true) } + } +} + +fun box(): String { + try { + Outer.Inner() + } catch (e: Throwable) { + return "Fail" + } + return "OK" +} diff --git a/compiler/testData/codegen/bytecodeText/assert/jvmCrossinlineAssertInLambda.kt b/compiler/testData/codegen/bytecodeText/assert/jvmCrossinlineAssertInLambda.kt index 3bd5195bf4f..50890f3dd80 100644 --- a/compiler/testData/codegen/bytecodeText/assert/jvmCrossinlineAssertInLambda.kt +++ b/compiler/testData/codegen/bytecodeText/assert/jvmCrossinlineAssertInLambda.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND: JVM // IGNORE_BACKEND: JVM_IR // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm @@ -15,7 +16,7 @@ class A { // inlineSite: // 1 GETSTATIC A\$inlineSite\$\$inlined\$inlineMe\$1.\$assertionsDisabled // A.: -// 1 LDC LA\$inlineSite\$\$inlined\$inlineMe\$1;.class\s*INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z +// 1 LDC LA;.class\s*INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z // 1 PUTSTATIC A\$inlineSite\$\$inlined\$inlineMe\$1.\$assertionsDisabled : Z // in declaration site and in inline site // 2 INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z diff --git a/compiler/testData/codegen/bytecodeText/assert/jvmNestedClass.kt b/compiler/testData/codegen/bytecodeText/assert/jvmNestedClass.kt new file mode 100644 index 00000000000..eabadf9a17c --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/assert/jvmNestedClass.kt @@ -0,0 +1,23 @@ +// IGNORE_BACKEND: JVM +// IGNORE_BACKEND: JVM_IR +// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm + +class Outer { + class Inner { + fun f() { assert(true) } + } +} + +// We set the assertion status based on top-level classes. +// 0 LDC LOuter\$Inner;.class +// 1 desiredAssertionStatus +// The assertion disabled field should be package local. +// 1 final static synthetic Z \$assertionsDisabled +// 0 public final static synthetic Z \$assertionsDisabled +// 0 protected final static synthetic Z \$assertionsDisabled +// 0 private final static synthetic Z \$assertionsDisabled +// Outer\$Inner.: +// 1 LDC LOuter;.class\s*INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z +// 1 PUTSTATIC Outer\$Inner.\$assertionsDisabled : Z +// Outer\$Inner.f: +// 1 GETSTATIC Outer\$Inner.\$assertionsDisabled \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index f3ca63f83fa..8223243fefb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -854,6 +854,36 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("assertionsEnabledBeforeClassInitializers.kt") + public void testAssertionsEnabledBeforeClassInitializers() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt"); + } + + @TestMetadata("classAssertions.kt") + public void testClassAssertions() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertions.kt"); + } + + @TestMetadata("classAssertionsForCompanion.kt") + public void testClassAssertionsForCompanion() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt"); + } + + @TestMetadata("classAssertionsForInnerClasses.kt") + public void testClassAssertionsForInnerClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt"); + } + + @TestMetadata("classAssertionsForLocalClasses.kt") + public void testClassAssertionsForLocalClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt"); + } + + @TestMetadata("classAssertionsForNestedClasses.kt") + public void testClassAssertionsForNestedClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt"); + } + @TestMetadata("interfaceAssertionsDisabled.kt") public void testInterfaceAssertionsDisabled() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt"); @@ -864,6 +894,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt"); } + @TestMetadata("lambdaNotEvaluated.kt") + public void testLambdaNotEvaluated() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt"); + } + @TestMetadata("localAnonymousFunction.kt") public void testLocalAnonymousFunction() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt"); @@ -889,6 +924,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/assert/jvm/localObject.kt"); } + @TestMetadata("noUnnecessaryClassInitialization.kt") + public void testNoUnnecessaryClassInitialization() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt"); + } + @TestMetadata("nonLocalReturn.kt") public void testNonLocalReturn() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index 37e4157b258..dcbaa65f0e4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -433,6 +433,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { public void testJvmInlineLambda() throws Exception { runTest("compiler/testData/codegen/bytecodeText/assert/jvmInlineLambda.kt"); } + + @TestMetadata("jvmNestedClass.kt") + public void testJvmNestedClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/assert/jvmNestedClass.kt"); + } } @TestMetadata("compiler/testData/codegen/bytecodeText/boxing") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index f27cb0fa998..74376752ad6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -842,6 +842,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Jvm extends AbstractLightAnalysisModeTest { + @TestMetadata("classAssertionsForInnerClasses.kt") + public void ignoreClassAssertionsForInnerClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt"); + } + + @TestMetadata("classAssertionsForLocalClasses.kt") + public void ignoreClassAssertionsForLocalClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt"); + } + + @TestMetadata("classAssertionsForNestedClasses.kt") + public void ignoreClassAssertionsForNestedClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt"); + } + private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -854,6 +869,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("assertionsEnabledBeforeClassInitializers.kt") + public void testAssertionsEnabledBeforeClassInitializers() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt"); + } + + @TestMetadata("classAssertions.kt") + public void testClassAssertions() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertions.kt"); + } + + @TestMetadata("classAssertionsForCompanion.kt") + public void testClassAssertionsForCompanion() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt"); + } + @TestMetadata("interfaceAssertionsDisabled.kt") public void testInterfaceAssertionsDisabled() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt"); @@ -864,6 +894,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt"); } + @TestMetadata("lambdaNotEvaluated.kt") + public void testLambdaNotEvaluated() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt"); + } + @TestMetadata("localAnonymousFunction.kt") public void testLocalAnonymousFunction() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt"); @@ -889,6 +924,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/assert/jvm/localObject.kt"); } + @TestMetadata("noUnnecessaryClassInitialization.kt") + public void testNoUnnecessaryClassInitialization() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt"); + } + @TestMetadata("nonLocalReturn.kt") public void testNonLocalReturn() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 75c5e35e55a..654be2e60cb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -854,6 +854,36 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/assert/jvm"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true); } + @TestMetadata("assertionsEnabledBeforeClassInitializers.kt") + public void testAssertionsEnabledBeforeClassInitializers() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt"); + } + + @TestMetadata("classAssertions.kt") + public void testClassAssertions() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertions.kt"); + } + + @TestMetadata("classAssertionsForCompanion.kt") + public void testClassAssertionsForCompanion() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt"); + } + + @TestMetadata("classAssertionsForInnerClasses.kt") + public void testClassAssertionsForInnerClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt"); + } + + @TestMetadata("classAssertionsForLocalClasses.kt") + public void testClassAssertionsForLocalClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt"); + } + + @TestMetadata("classAssertionsForNestedClasses.kt") + public void testClassAssertionsForNestedClasses() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt"); + } + @TestMetadata("interfaceAssertionsDisabled.kt") public void testInterfaceAssertionsDisabled() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt"); @@ -864,6 +894,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt"); } + @TestMetadata("lambdaNotEvaluated.kt") + public void testLambdaNotEvaluated() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt"); + } + @TestMetadata("localAnonymousFunction.kt") public void testLocalAnonymousFunction() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt"); @@ -889,6 +924,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/assert/jvm/localObject.kt"); } + @TestMetadata("noUnnecessaryClassInitialization.kt") + public void testNoUnnecessaryClassInitialization() throws Exception { + runTest("compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt"); + } + @TestMetadata("nonLocalReturn.kt") public void testNonLocalReturn() throws Exception { runTest("compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index 15b4fa92db3..a0c364fdca8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -433,6 +433,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { public void testJvmInlineLambda() throws Exception { runTest("compiler/testData/codegen/bytecodeText/assert/jvmInlineLambda.kt"); } + + @TestMetadata("jvmNestedClass.kt") + public void testJvmNestedClass() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/assert/jvmNestedClass.kt"); + } } @TestMetadata("compiler/testData/codegen/bytecodeText/boxing")