JVM_IR KT-49765 bridge for throwing stub should just throw UOE
This commit is contained in:
+52
@@ -2635,6 +2635,58 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BridgesForStubs {
|
||||
@Test
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyListAdd.kt")
|
||||
public void testDerivedEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyListSeveralModulesAdd.kt")
|
||||
public void testDerivedEmptyListSeveralModulesAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListSeveralModulesAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyStringListAdd.kt")
|
||||
public void testDerivedEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyStringListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListAdd.kt")
|
||||
public void testEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListAddWithIndex.kt")
|
||||
public void testEmptyListAddWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAddWithIndex.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListSet.kt")
|
||||
public void testEmptyListSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyStringListAdd.kt")
|
||||
public void testEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+24
-1
@@ -430,7 +430,17 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
|
||||
}.apply {
|
||||
copyAttributes(target)
|
||||
copyParametersWithErasure(this@addBridge, bridge.overridden)
|
||||
body = context.createIrBuilder(symbol, startOffset, endOffset).run { irExprBody(delegatingCall(this@apply, target)) }
|
||||
|
||||
// If target is a throwing stub, bridge also should just throw UnsupportedOperationException.
|
||||
// Otherwise, it might throw ClassCastException when downcasting bridge argument to expected type.
|
||||
// See KT-49765
|
||||
body = if (target.isThrowingStub()) {
|
||||
createThrowingStubBody(context, this)
|
||||
} else {
|
||||
context.createIrBuilder(symbol, startOffset, endOffset).run {
|
||||
irExprBody(delegatingCall(this@apply, target))
|
||||
}
|
||||
}
|
||||
|
||||
if (!bridge.overridden.returnType.isTypeParameterWithPrimitiveUpperBound()) {
|
||||
// The generated bridge method overrides all of the symbols which were overridden by its overrides.
|
||||
@@ -446,6 +456,19 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrSimpleFunction.isThrowingStub(): Boolean {
|
||||
if (this.origin != IrDeclarationOrigin.IR_BUILTINS_STUB &&
|
||||
this.origin != IrDeclarationOrigin.BRIDGE &&
|
||||
this.origin != IrDeclarationOrigin.BRIDGE_SPECIAL
|
||||
) {
|
||||
return false
|
||||
}
|
||||
val body = this.body as? IrBlockBody ?: return false
|
||||
if (body.statements.size != 1) return false
|
||||
val irCall = body.statements[0] as? IrCall ?: return false
|
||||
return irCall.symbol == context.ir.symbols.throwUnsupportedOperationException
|
||||
}
|
||||
|
||||
private fun IrType.isTypeParameterWithPrimitiveUpperBound(): Boolean =
|
||||
isTypeParameter() && eraseTypeParameters().isPrimitiveType()
|
||||
|
||||
|
||||
+13
-12
@@ -150,7 +150,7 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl
|
||||
valueParameters = removeAtStub.valueParameters.map { stubParameter ->
|
||||
stubParameter.copyWithCustomTypeSubstitution(this) { it }
|
||||
}
|
||||
body = createThrowingStubBody(this)
|
||||
body = createThrowingStubBody(context, this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl
|
||||
dispatchReceiverParameter = function.dispatchReceiverParameter?.copyWithSubstitution(this, substitutionMap)
|
||||
extensionReceiverParameter = function.extensionReceiverParameter?.copyWithSubstitution(this, substitutionMap)
|
||||
valueParameters = function.valueParameters.map { it.copyWithSubstitution(this, substitutionMap) }
|
||||
body = createThrowingStubBody(this)
|
||||
body = createThrowingStubBody(context, this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,17 +192,8 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl
|
||||
function.returnType
|
||||
}
|
||||
|
||||
private fun createThrowingStubBody(function: IrSimpleFunction) =
|
||||
context.createIrBuilder(function.symbol).irBlockBody {
|
||||
// Function body consist only of throwing UnsupportedOperationException statement
|
||||
+irCall(this@CollectionStubMethodLowering.context.ir.symbols.throwUnsupportedOperationException)
|
||||
.apply {
|
||||
putValueArgument(0, irString("Operation is not supported for read-only collection"))
|
||||
}
|
||||
}
|
||||
|
||||
private fun isEffectivelyOverriddenBy(superFun: IrSimpleFunction, overridingFun: IrSimpleFunction): Boolean {
|
||||
// Function 'f0' is overridden by function 'f1' if all of the following conditions are met,
|
||||
// Function 'f0' is overridden by function 'f1' if all the following conditions are met,
|
||||
// assuming type parameter Ti of 'f1' is "equal" to type parameter Si of 'f0':
|
||||
// - names are same;
|
||||
// - 'f1' has the same number of type parameters,
|
||||
@@ -390,3 +381,13 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl
|
||||
private val IrClass.superClassChain: Sequence<IrClass>
|
||||
get() = generateSequence(this) { it.superClass }
|
||||
}
|
||||
|
||||
|
||||
fun createThrowingStubBody(context: JvmBackendContext, function: IrSimpleFunction) =
|
||||
context.createIrBuilder(function.symbol).irBlockBody {
|
||||
// Function body consist only of throwing UnsupportedOperationException statement
|
||||
+irCall(context.ir.symbols.throwUnsupportedOperationException)
|
||||
.apply {
|
||||
putValueArgument(0, irString("Operation is not supported for read-only collection"))
|
||||
}
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: derivedEmptyListAdd.kt
|
||||
|
||||
open class EmptyListBase<T> : List<T>, RandomAccess {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: T): Boolean = false
|
||||
override fun containsAll(elements: Collection<T>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): T = null!!
|
||||
override fun indexOf(element: T): Int = -1
|
||||
override fun lastIndexOf(element: T): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<T> = null!!
|
||||
override fun listIterator(): ListIterator<T> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<T> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<T> = null!!
|
||||
}
|
||||
|
||||
object EmptyList : EmptyListBase<Nothing>()
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.add()
|
||||
return "Fail: no exception is thrown from J.add()"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add()", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void add() {
|
||||
EmptyList.INSTANCE.add("");
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: RandomAccessList.kt
|
||||
|
||||
abstract class RandomAccessList<T> : List<T>, RandomAccess
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: derivedEmptyListSeveralModulesAdd.kt
|
||||
|
||||
open class EmptyListBase<T> : RandomAccessList<T>() {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: T): Boolean = false
|
||||
override fun containsAll(elements: Collection<T>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): T = null!!
|
||||
override fun indexOf(element: T): Int = -1
|
||||
override fun lastIndexOf(element: T): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<T> = null!!
|
||||
override fun listIterator(): ListIterator<T> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<T> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<T> = null!!
|
||||
}
|
||||
|
||||
object EmptyList : EmptyListBase<Nothing>()
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.add()
|
||||
return "Fail: no exception is thrown from J.add()"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add()", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void add() {
|
||||
EmptyList.INSTANCE.add("");
|
||||
}
|
||||
}
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: derivedEmptyStringListAdd.kt
|
||||
|
||||
open class EmptyListBase<T : CharSequence> : List<T>, RandomAccess {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: T): Boolean = false
|
||||
override fun containsAll(elements: Collection<T>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): T = null!!
|
||||
override fun indexOf(element: T): Int = -1
|
||||
override fun lastIndexOf(element: T): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<T> = null!!
|
||||
override fun listIterator(): ListIterator<T> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<T> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<T> = null!!
|
||||
}
|
||||
|
||||
object EmptyStringList : EmptyListBase<String>()
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.add()
|
||||
return "Fail: no exception is thrown from J.add()"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add()", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void add() {
|
||||
EmptyStringList.INSTANCE.add("");
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: emptyListAdd.kt
|
||||
|
||||
object EmptyList : List<Nothing>, RandomAccess {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: Nothing): Boolean = false
|
||||
override fun containsAll(elements: Collection<Nothing>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): Nothing = null!!
|
||||
override fun indexOf(element: Nothing): Int = -1
|
||||
override fun lastIndexOf(element: Nothing): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<Nothing> = null!!
|
||||
override fun listIterator(): ListIterator<Nothing> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<Nothing> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<Nothing> = null!!
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.add()
|
||||
return "Fail: no exception is thrown from J.add()"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add()", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void add() {
|
||||
EmptyList.INSTANCE.add("");
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: emptyListAddWithIndex.kt
|
||||
|
||||
object EmptyList : List<Nothing>, RandomAccess {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: Nothing): Boolean = false
|
||||
override fun containsAll(elements: Collection<Nothing>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): Nothing = null!!
|
||||
override fun indexOf(element: Nothing): Int = -1
|
||||
override fun lastIndexOf(element: Nothing): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<Nothing> = null!!
|
||||
override fun listIterator(): ListIterator<Nothing> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<Nothing> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<Nothing> = null!!
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.test()
|
||||
return "Fail: no exception is thrown from J.add()"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add()", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void test() {
|
||||
EmptyList.INSTANCE.add(0, "");
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: emptyListSet.kt
|
||||
|
||||
object EmptyList : List<Nothing>, RandomAccess {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: Nothing): Boolean = false
|
||||
override fun containsAll(elements: Collection<Nothing>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): Nothing = null!!
|
||||
override fun indexOf(element: Nothing): Int = -1
|
||||
override fun lastIndexOf(element: Nothing): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<Nothing> = null!!
|
||||
override fun listIterator(): ListIterator<Nothing> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<Nothing> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<Nothing> = null!!
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.test()
|
||||
return "Fail: no exception is thrown from J.add()"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add()", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void test() {
|
||||
EmptyList.INSTANCE.set(0, "");
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FULL_JDK
|
||||
// FILE: emptyStringListAdd.kt
|
||||
|
||||
object EmptyStringList : List<String> {
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: String): Boolean = false
|
||||
override fun containsAll(elements: Collection<String>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun get(index: Int): String = null!!
|
||||
override fun indexOf(element: String): Int = -1
|
||||
override fun lastIndexOf(element: String): Int = -1
|
||||
|
||||
override fun iterator(): Iterator<String> = null!!
|
||||
override fun listIterator(): ListIterator<String> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<String> = null!!
|
||||
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<String> = null!!
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
J.add42(EmptyStringList)
|
||||
return "Fail: no exception is thrown from J.add42(list)"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
throw AssertionError("Fail: incorrect exception is thrown from J.add42(list)", e)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static void add42(List list) {
|
||||
list.add(42);
|
||||
}
|
||||
}
|
||||
+52
@@ -2557,6 +2557,58 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BridgesForStubs {
|
||||
@Test
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyListAdd.kt")
|
||||
public void testDerivedEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyListSeveralModulesAdd.kt")
|
||||
public void testDerivedEmptyListSeveralModulesAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListSeveralModulesAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyStringListAdd.kt")
|
||||
public void testDerivedEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyStringListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListAdd.kt")
|
||||
public void testEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListAddWithIndex.kt")
|
||||
public void testEmptyListAddWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAddWithIndex.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListSet.kt")
|
||||
public void testEmptyListSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyStringListAdd.kt")
|
||||
public void testEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+52
@@ -2635,6 +2635,58 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BridgesForStubs {
|
||||
@Test
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyListAdd.kt")
|
||||
public void testDerivedEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyListSeveralModulesAdd.kt")
|
||||
public void testDerivedEmptyListSeveralModulesAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListSeveralModulesAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("derivedEmptyStringListAdd.kt")
|
||||
public void testDerivedEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyStringListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListAdd.kt")
|
||||
public void testEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAdd.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListAddWithIndex.kt")
|
||||
public void testEmptyListAddWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAddWithIndex.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyListSet.kt")
|
||||
public void testEmptyListSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyStringListAdd.kt")
|
||||
public void testEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+48
@@ -2238,6 +2238,54 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/substitutedListWithExtraSuperInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BridgesForStubs extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("derivedEmptyListAdd.kt")
|
||||
public void testDerivedEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListAdd.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("derivedEmptyListSeveralModulesAdd.kt")
|
||||
public void testDerivedEmptyListSeveralModulesAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyListSeveralModulesAdd.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("derivedEmptyStringListAdd.kt")
|
||||
public void testDerivedEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/derivedEmptyStringListAdd.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("emptyListAdd.kt")
|
||||
public void testEmptyListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAdd.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("emptyListAddWithIndex.kt")
|
||||
public void testEmptyListAddWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListAddWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("emptyListSet.kt")
|
||||
public void testEmptyListSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyListSet.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("emptyStringListAdd.kt")
|
||||
public void testEmptyStringListAdd() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+10
@@ -1723,6 +1723,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BridgesForStubs {
|
||||
@Test
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -1765,6 +1765,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class BridgesForStubs {
|
||||
@Test
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+13
@@ -1568,6 +1568,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BridgesForStubs extends AbstractIrCodegenBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+11
@@ -1785,6 +1785,17 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/customReadOnlyIterator.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@NativeBlackBoxTestCaseGroupProvider(ExtTestCaseGroupProvider.class)
|
||||
public class BridgesForStubs {
|
||||
@Test
|
||||
public void testAllFilesPresentInBridgesForStubs() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/bridgesForStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user