diff --git a/compiler/testData/codegen/bytecodeText/mapGetOrDefault.kt b/compiler/testData/codegen/bytecodeText/mapGetOrDefault.kt new file mode 100644 index 00000000000..8df6d39b2cb --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/mapGetOrDefault.kt @@ -0,0 +1,30 @@ +// JVM_TARGET: 1.8 +// WITH_RUNTIME +// FULL_JDK +// FILE: TestMap.java + +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Set; + +public class TestMap implements Map { + public void clear() {} + public boolean isEmpty() { return true; } + public int size() { return 0; } + public boolean containsKey(Object key) { return false; } + public boolean containsValue(Object value) { return false; } + public V get(Object key) { return null; } + public V put(K key, V value) { return null; } + public V remove(Object key) { return null; } + public void putAll(Map m) {} + public Set keySet() { return Collections.EMPTY_SET; } + public Collection values() {return Collections.EMPTY_SET; } + public Set> entrySet() { return Collections.EMPTY_SET; } +} + +// FILE: main.kt + +class MyMap: TestMap() + +// 1 public final bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/Object;\)Ljava/lang/Object; diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt index d6bea1b68cc..0c4524bf654 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.kt @@ -9,7 +9,6 @@ import com.intellij.openapi.util.text.StringUtil import org.jetbrains.kotlin.test.ConfigurationKind import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.TargetBackend -import org.jetbrains.kotlin.test.TestJdkKind import org.junit.Assert import java.io.File import java.util.* @@ -22,7 +21,7 @@ abstract class AbstractBytecodeTextTest : CodegenTestCase() { createEnvironmentWithMockJdkAndIdeaAnnotations( ConfigurationKind.ALL, files, - TestJdkKind.MOCK_JDK, + getJdkKind(files), *listOfNotNull(writeJavaFiles(files)).toTypedArray() ) loadMultiFiles(files) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index 10fbffa4697..7f845ec31e6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -259,6 +259,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/kt9603.kt"); } + @TestMetadata("mapGetOrDefault.kt") + public void testMapGetOrDefault() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/mapGetOrDefault.kt"); + } + @TestMetadata("maxStackAfterOptimizations.kt") public void testMaxStackAfterOptimizations() throws Exception { runTest("compiler/testData/codegen/bytecodeText/maxStackAfterOptimizations.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java index 4c4ef65800e..2e6646faf5f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeTextTestGenerated.java @@ -259,6 +259,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/kt9603.kt"); } + @TestMetadata("mapGetOrDefault.kt") + public void testMapGetOrDefault() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/mapGetOrDefault.kt"); + } + @TestMetadata("maxStackAfterOptimizations.kt") public void testMaxStackAfterOptimizations() throws Exception { runTest("compiler/testData/codegen/bytecodeText/maxStackAfterOptimizations.kt");