JVM_IR fix special bridges in mixed Java/Kotlin hierarchies
KT-50257 KT-50476
This commit is contained in:
+65
-11
@@ -2736,54 +2736,108 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExtendJavaCollections {
|
||||
public class ExtendJavaClasses {
|
||||
@Test
|
||||
@TestMetadata("abstractList.kt")
|
||||
public void testAbstractList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("abstractMap.kt")
|
||||
public void testAbstractMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceGetOverriddenInJavaSuperClass.kt")
|
||||
public void testCharSequenceGetOverriddenInJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/charSequenceGetOverriddenInJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mapEntry.kt")
|
||||
public void testMapEntry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/mapEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("numberMixedHierarchy.kt")
|
||||
public void testNumberMixedHierarchy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/numberMixedHierarchy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaClass.kt")
|
||||
public void testRemoveAtBridgeToJavaClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaDefault.kt")
|
||||
public void testRemoveAtBridgeToJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaSuperClass.kt")
|
||||
public void testRemoveAtBridgeToJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToFakeRemoveAt.kt")
|
||||
public void testSuperCallToFakeRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToFakeRemoveAt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToRemoveAt.kt")
|
||||
public void testSuperCallToRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToRemoveAtInJavaDefault.kt")
|
||||
public void testSuperCallToRemoveAtInJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAtInJavaDefault.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-15
@@ -228,33 +228,35 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
|
||||
return irFunction
|
||||
}
|
||||
|
||||
// If irFunction is a fake override, we replace it with a stub and redirect all calls to irFunction with
|
||||
// calls to the stub instead. Otherwise we'll end up calling the special method itself and get into an
|
||||
// infinite loop.
|
||||
//
|
||||
// There are three cases to consider. If the method is abstract, then we simply generate a concrete abstract method
|
||||
// to avoid generating a call to a method which does not exist in the current class. If the method is final,
|
||||
// then we will not override it in a subclass and we do not need to generate an additional stub method.
|
||||
//
|
||||
// Finally, if we have a non-abstract, non-final fake-override we need to put in an additional bridge which uses
|
||||
// INVOKESPECIAL to call the special bridge implementation in the superclass. We can be sure that an implementation
|
||||
// exists in a superclass, since we do not generate bridges for fake overrides of interface methods.
|
||||
if (irFunction.isFakeOverride) {
|
||||
// If irFunction is a fake override, we replace it with a stub and redirect all calls to irFunction with calls to the stub
|
||||
// instead. Otherwise, we'll end up calling the special method itself and get into an infinite loop.
|
||||
bridgeTarget = when {
|
||||
irFunction.isJvmAbstract(context.state.jvmDefaultMode) -> {
|
||||
// If the method is abstract, then we simply generate a concrete abstract method
|
||||
// to avoid generating a call to a method which does not exist in the current class.
|
||||
irClass.declarations.remove(irFunction)
|
||||
irClass.addAbstractMethodStub(irFunction)
|
||||
}
|
||||
irFunction.modality != Modality.FINAL -> {
|
||||
// If we have a non-abstract, non-final fake-override we need to put in an additional bridge which uses
|
||||
// INVOKESPECIAL to call the special bridge implementation in the superclass.
|
||||
// We can be sure that an implementation exists in a superclass,
|
||||
// since we do not generate bridges for fake overrides of interface methods.
|
||||
val overriddenFromClass = irFunction.overriddenFromClass()!!
|
||||
val superBridge = SpecialBridge(
|
||||
irFunction, irFunction.jvmMethod, superQualifierSymbol = overriddenFromClass.parentAsClass.symbol,
|
||||
overridden = irFunction,
|
||||
signature = irFunction.jvmMethod,
|
||||
superQualifierSymbol = overriddenFromClass.parentAsClass.symbol,
|
||||
methodInfo = specialBridge.methodInfo?.copy(argumentsToCheck = 0), // For potential argument boxing
|
||||
isFinal = false,
|
||||
)
|
||||
|
||||
// The part after '?:' is needed for methods with default implementations in collection interfaces:
|
||||
// MutableMap.remove() and getOrDefault().
|
||||
val superTarget = overriddenFromClass.takeIf { !it.isFakeOverride } ?: specialBridge.overridden
|
||||
val superTarget = overriddenFromClass.takeIf { !it.isFakeOverride || !specialBridge.isOverriding }
|
||||
?: specialBridge.overridden
|
||||
|
||||
if (superBridge.signature == superTarget.jvmMethod) {
|
||||
// If the resulting bridge to a super member matches the signature of the bridge callee,
|
||||
// bridge is not needed.
|
||||
@@ -265,6 +267,8 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
// If the method is final,
|
||||
// then we will not override it in a subclass and we do not need to generate an additional stub method.
|
||||
irFunction
|
||||
}
|
||||
}
|
||||
@@ -320,7 +324,7 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
|
||||
return
|
||||
}
|
||||
|
||||
// For concrete fake overrides, some of the bridges may be inherited from the super-classes. Specifically, bridges for all
|
||||
// For concrete fake overrides, some bridges may be inherited from the super-classes. Specifically, bridges for all
|
||||
// declarations that are reachable from all concrete immediate super-functions of the given function. Note that all such bridges are
|
||||
// guaranteed to delegate to the same implementation as bridges for the given function, that's why it's safe to inherit them.
|
||||
//
|
||||
@@ -359,7 +363,6 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
|
||||
private fun IrSimpleFunction.isClashingWithPotentialBridge(name: Name, signature: Method): Boolean =
|
||||
(!this.isFakeOverride || this.modality == Modality.FINAL) && this.name == name && this.jvmMethod == signature
|
||||
|
||||
|
||||
// Returns the special bridge overridden by the current methods if it exists.
|
||||
private val IrSimpleFunction.specialBridgeOrNull: SpecialBridge?
|
||||
get() = context.bridgeLoweringCache.computeSpecialBridge(this)
|
||||
|
||||
+5
-2
@@ -54,7 +54,8 @@ class BridgeLoweringCache(private val context: JvmBackendContext) {
|
||||
val specialMethodInfo = specialBridgeMethods.getSpecialMethodInfo(function)
|
||||
if (specialMethodInfo != null)
|
||||
return SpecialBridge(
|
||||
overridden = function, signature = computeJvmMethod(function),
|
||||
overridden = function,
|
||||
signature = computeJvmMethod(function),
|
||||
needsGenericSignature = specialMethodInfo.needsGenericSignature,
|
||||
methodInfo = specialMethodInfo,
|
||||
needsUnsubstitutedBridge = specialMethodInfo.needsUnsubstitutedBridge
|
||||
@@ -63,7 +64,9 @@ class BridgeLoweringCache(private val context: JvmBackendContext) {
|
||||
val specialBuiltInInfo = specialBridgeMethods.getBuiltInWithDifferentJvmName(function)
|
||||
if (specialBuiltInInfo != null)
|
||||
return SpecialBridge(
|
||||
function, computeJvmMethod(function), specialBuiltInInfo.needsGenericSignature,
|
||||
overridden = function,
|
||||
signature = computeJvmMethod(function),
|
||||
needsGenericSignature = specialBuiltInInfo.needsGenericSignature,
|
||||
isOverriding = specialBuiltInInfo.isOverriding
|
||||
)
|
||||
|
||||
|
||||
+4
-1
@@ -227,7 +227,10 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
mapSignature(function, false)
|
||||
|
||||
private fun mapSignature(function: IrFunction, skipGenericSignature: Boolean, skipSpecial: Boolean = false): JvmMethodGenericSignature {
|
||||
if (function is IrLazyFunctionBase && !function.isFakeOverride && function.initialSignatureFunction != null) {
|
||||
if (function is IrLazyFunctionBase &&
|
||||
(!function.isFakeOverride || function.parentAsClass.isFromJava()) &&
|
||||
function.initialSignatureFunction != null
|
||||
) {
|
||||
// Overrides of special builtin in Kotlin classes always have special signature
|
||||
if ((function as? IrSimpleFunction)?.getDifferentNameForJvmBuiltinFunction() == null ||
|
||||
(function.parent as? IrClass)?.origin == IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||
|
||||
+5
-1
@@ -25,7 +25,11 @@ interface IrLazyFunctionBase : IrLazyDeclarationBase, IrTypeParametersContainer
|
||||
fun createInitialSignatureFunction(): Lazy<IrFunction?> =
|
||||
// Need SYNCHRONIZED; otherwise two stubs generated in parallel may fight for the same symbol.
|
||||
lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
descriptor.initialSignatureDescriptor?.takeIf { it != descriptor }?.original?.let(stubGenerator::generateFunctionStub)
|
||||
val initialSignatureDescriptor = descriptor.initialSignatureDescriptor
|
||||
?: return@lazy null
|
||||
if (initialSignatureDescriptor == descriptor)
|
||||
return@lazy null
|
||||
stubGenerator.generateFunctionStub(initialSignatureDescriptor.original)
|
||||
}
|
||||
|
||||
fun createValueParameters(): List<IrValueParameter> =
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package org.jetbrains.kotlin.ir.util
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.IrLock
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.lazy.*
|
||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.linkage.IrProvider
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
|
||||
import org.jetbrains.kotlin.resolve.isInlineClass
|
||||
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
@@ -235,9 +234,12 @@ abstract class DeclarationStubGenerator(
|
||||
private fun KotlinType.toIrType() = typeTranslator.translateType(this)
|
||||
|
||||
internal fun generateValueParameterStub(descriptor: ValueParameterDescriptor, index: Int): IrValueParameter = with(descriptor) {
|
||||
IrLazyValueParameter(UNDEFINED_OFFSET, UNDEFINED_OFFSET, computeOrigin(this), IrValueParameterSymbolImpl(this), this, name, index,
|
||||
type.toIrType(), varargElementType?.toIrType(), isCrossinline, isNoinline, isHidden = false, isAssignable = false, this@DeclarationStubGenerator, typeTranslator)
|
||||
.also { irValueParameter ->
|
||||
IrLazyValueParameter(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, computeOrigin(this), IrValueParameterSymbolImpl(this), this, name, index,
|
||||
type.toIrType(), varargElementType?.toIrType(),
|
||||
isCrossinline = isCrossinline, isNoinline = isNoinline, isHidden = false, isAssignable = false,
|
||||
stubGenerator = this@DeclarationStubGenerator, typeTranslator = typeTranslator
|
||||
).also { irValueParameter ->
|
||||
if (descriptor.declaresDefaultValue()) {
|
||||
irValueParameter.defaultValue = irValueParameter.createStubDefaultValue()
|
||||
}
|
||||
@@ -324,7 +326,8 @@ abstract class DeclarationStubGenerator(
|
||||
descriptor.index,
|
||||
descriptor.isReified,
|
||||
descriptor.variance,
|
||||
this, typeTranslator)
|
||||
this, typeTranslator
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +347,8 @@ abstract class DeclarationStubGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
private fun findDescriptorBySignature(signature: IdSignature): DeclarationDescriptor? = when (signature) {
|
||||
private fun findDescriptorBySignature(signature: IdSignature): DeclarationDescriptor? =
|
||||
when (signature) {
|
||||
is IdSignature.AccessorSignature -> findDescriptorForAccessorSignature(signature)
|
||||
is IdSignature.CommonSignature -> findDescriptorForPublicSignature(signature)
|
||||
else -> error("only PublicSignature or AccessorSignature should reach this point, got $signature")
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: charSequenceGetOverriddenInJavaSuperClass.kt
|
||||
abstract class KACharSequence : JACharSequence()
|
||||
|
||||
class Test(s: String) : JCharSequence(s)
|
||||
|
||||
fun box(): String {
|
||||
val t = Test("OK")
|
||||
return "" + t[0] + t[1]
|
||||
}
|
||||
|
||||
// FILE: JACharSequence.java
|
||||
public abstract class JACharSequence implements CharSequence {
|
||||
@Override
|
||||
public char charAt(int index) {
|
||||
return myCharAt(index);
|
||||
}
|
||||
|
||||
protected abstract char myCharAt(int index);
|
||||
}
|
||||
|
||||
// FILE: JCharSequence.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class JCharSequence extends KACharSequence {
|
||||
private final CharSequence d;
|
||||
|
||||
public JCharSequence(CharSequence d) {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char myCharAt(int index) {
|
||||
return d.charAt(index);
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return d.length();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
return d.subSequence(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return d.toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public IntStream codePoints() {
|
||||
return d.codePoints();
|
||||
}
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: STDLIB_COLLECTION_INHERITANCE
|
||||
|
||||
open class A : ArrayList<String>()
|
||||
|
||||
class B : A()
|
||||
|
||||
fun box(): String {
|
||||
val b = B()
|
||||
b += "OK"
|
||||
return b.single()
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FULL_JDK
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: numberMixedHierarchy.kt
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
abstract class KANumber0 : JANumber0() {
|
||||
// toInt()/intValue() implemented in JANumber0
|
||||
override fun toByte(): Byte = 0
|
||||
override fun toChar(): Char = 0.toChar()
|
||||
override fun toShort(): Short = 0
|
||||
override fun toLong() = 0L
|
||||
override fun toFloat() = 0.0f
|
||||
override fun toDouble() = 0.0
|
||||
}
|
||||
|
||||
class Test : JNumber0()
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
assertEquals(0.toByte(), t.toByte())
|
||||
assertEquals(0.toShort(), t.toShort())
|
||||
assertEquals(0, t.toInt())
|
||||
assertEquals(0L, t.toLong())
|
||||
assertEquals(0.0f, t.toFloat())
|
||||
assertEquals(0.0, t.toDouble())
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: JANumber0.java
|
||||
public abstract class JANumber0 extends Number {
|
||||
@Override
|
||||
public int intValue() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: JNumber0.java
|
||||
public class JNumber0 extends KANumber0 {
|
||||
}
|
||||
Vendored
+152
@@ -0,0 +1,152 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: removeAtBridgeToJavaClass.kt
|
||||
class Test : IntArrayList()
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
t.add(1)
|
||||
try {
|
||||
t.removeAt(0)
|
||||
return "Failed: should throw UOE"
|
||||
} catch (e: java.lang.UnsupportedOperationException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayList implements List<Integer> {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
Vendored
+171
@@ -0,0 +1,171 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FIR_STATUS: java.lang.StackOverflowError
|
||||
// at Test.remove(removeAtBridgeToJavaDefault.kt:7)
|
||||
// at Test.remove(removeAtBridgeToJavaDefault.kt:7)
|
||||
// at Test.remove(removeAtBridgeToJavaDefault.kt:7)
|
||||
|
||||
// FILE: removeAtBridgeToJavaDefault.kt
|
||||
class Test : IntArrayList()
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
t.add(1)
|
||||
try {
|
||||
t.removeAt(0)
|
||||
return "Failed: should throw UOE"
|
||||
} catch (e: java.lang.UnsupportedOperationException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: IntList.java
|
||||
import java.util.List;
|
||||
|
||||
public interface IntList extends List<Integer> {
|
||||
default Integer remove(int index) {
|
||||
return Integer.valueOf(removeInt(index));
|
||||
}
|
||||
|
||||
int removeInt(int index);
|
||||
}
|
||||
|
||||
// FILE: AbstractIntList.java
|
||||
public abstract class AbstractIntList implements IntList {
|
||||
public int removeInt(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayList extends AbstractIntList {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaSuperClass.kt
Vendored
+167
@@ -0,0 +1,167 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FIR_STATUS: java.lang.StackOverflowError
|
||||
// at Test.remove(removeAtBridgeToJavaSuperClass.kt:7)
|
||||
// at Test.remove(removeAtBridgeToJavaSuperClass.kt:7)
|
||||
// at Test.remove(removeAtBridgeToJavaSuperClass.kt:7)
|
||||
|
||||
// FILE: removeAtBridgeToJavaSuperClass.kt
|
||||
class Test : IntArrayList()
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
t.add(1)
|
||||
try {
|
||||
t.removeAt(0)
|
||||
return "Failed: should throw UOE"
|
||||
} catch (e: java.lang.UnsupportedOperationException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: AbstractIntList.java
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractIntList implements List<Integer> {
|
||||
@Override
|
||||
public Integer remove(int index) {
|
||||
return removeInt(index);
|
||||
}
|
||||
|
||||
public int removeInt(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayList extends AbstractIntList {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
Vendored
+156
@@ -0,0 +1,156 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: superCallToFakeRemoveAt.kt
|
||||
class Test : IntArrayList() {
|
||||
override fun removeAt(index: Int): Int {
|
||||
return super.removeAt(index)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
t.add(1)
|
||||
t.removeAt(0)
|
||||
// Just check that there's no exception (e.g., NSME)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: IntArrayListBase.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayListBase implements List<Integer> {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayListBase() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(int index) {
|
||||
return data.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
public class IntArrayList extends IntArrayListBase {}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: superCallToRemoveAt.kt
|
||||
class Test : IntArrayList() {
|
||||
override fun removeAt(index: Int): Int {
|
||||
return super.removeAt(index)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
t.add(1)
|
||||
t.removeAt(0)
|
||||
// Just check that there's no exception (e.g., NSME)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayList implements List<Integer> {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(int index) {
|
||||
return data.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FIR_STATUS: java.lang.NoSuchMethodError: IntArrayList.removeAt(I)Ljava/lang/Integer;
|
||||
|
||||
// FILE: superCallToRemoveAtInJavaDefault.kt
|
||||
class Test : IntArrayList() {
|
||||
override fun removeAt(index: Int): Int {
|
||||
return super.removeAt(index)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
t.add(1)
|
||||
t.removeAt(0)
|
||||
// Just check that there's no exception (e.g., NSME)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: IntList.java
|
||||
import java.util.List;
|
||||
|
||||
public interface IntList extends List<Integer> {
|
||||
default Integer remove(int index) {
|
||||
return removeInt(index);
|
||||
}
|
||||
|
||||
int removeInt(int index);
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayList implements IntList {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeInt(int index) {
|
||||
return data.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SKIP_JDK6
|
||||
// FULL_JDK
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: intArrayList.kt
|
||||
class Test : IntArrayList()
|
||||
|
||||
// FILE: IntList.java
|
||||
import java.util.List;
|
||||
|
||||
public interface IntList extends List<Integer> {
|
||||
default Integer remove(int index) {
|
||||
return Integer.valueOf(removeInt(index));
|
||||
}
|
||||
|
||||
int removeInt(int index);
|
||||
}
|
||||
|
||||
// FILE: AbstractIntList.java
|
||||
public abstract class AbstractIntList implements IntList {
|
||||
public int removeInt(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: IntArrayList.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class IntArrayList extends AbstractIntList {
|
||||
private final ArrayList<Integer> data = new ArrayList<>();
|
||||
|
||||
public IntArrayList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return data.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return data.contains(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<Integer> iterator() {
|
||||
return data.iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return data.toArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return data.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Integer integer) {
|
||||
return data.add(integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return data.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return data.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends Integer> c) {
|
||||
return data.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return data.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return data.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(int index, Integer element) {
|
||||
return data.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, Integer element) {
|
||||
data.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return data.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return data.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator() {
|
||||
return data.listIterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<Integer> listIterator(int index) {
|
||||
return data.listIterator(index);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> subList(int fromIndex, int toIndex) {
|
||||
return data.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
@kotlin.Metadata
|
||||
public final class Test {
|
||||
// source: 'intArrayList.kt'
|
||||
public method <init>(): void
|
||||
public bridge method contains(p0: java.lang.Integer): boolean
|
||||
public bridge final method contains(p0: java.lang.Object): boolean
|
||||
public bridge method getSize(): int
|
||||
public bridge method indexOf(p0: java.lang.Integer): int
|
||||
public bridge final method indexOf(p0: java.lang.Object): int
|
||||
public bridge method lastIndexOf(p0: java.lang.Integer): int
|
||||
public bridge final method lastIndexOf(p0: java.lang.Object): int
|
||||
public bridge final method remove(p0: int): java.lang.Integer
|
||||
public bridge method remove(p0: java.lang.Integer): boolean
|
||||
public bridge final method remove(p0: java.lang.Object): boolean
|
||||
public bridge method removeAt(p0: int): java.lang.Integer
|
||||
public bridge final method size(): int
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
@kotlin.Metadata
|
||||
public final class Test {
|
||||
// source: 'intArrayList.kt'
|
||||
public method <init>(): void
|
||||
public bridge method contains(p0: java.lang.Integer): boolean
|
||||
public bridge final method contains(p0: java.lang.Object): boolean
|
||||
public bridge method getSize(): int
|
||||
public bridge method indexOf(p0: java.lang.Integer): int
|
||||
public bridge final method indexOf(p0: java.lang.Object): int
|
||||
public bridge method lastIndexOf(p0: java.lang.Integer): int
|
||||
public bridge final method lastIndexOf(p0: java.lang.Object): int
|
||||
public bridge final method remove(p0: int): java.lang.Integer
|
||||
public synthetic bridge method remove(p0: int): java.lang.Object
|
||||
public bridge method remove(p0: java.lang.Integer): boolean
|
||||
public bridge final method remove(p0: java.lang.Object): boolean
|
||||
public bridge method removeAt(p0: int): java.lang.Integer
|
||||
public bridge final method size(): int
|
||||
}
|
||||
+65
-11
@@ -2652,54 +2652,108 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExtendJavaCollections {
|
||||
public class ExtendJavaClasses {
|
||||
@Test
|
||||
@TestMetadata("abstractList.kt")
|
||||
public void testAbstractList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("abstractMap.kt")
|
||||
public void testAbstractMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceGetOverriddenInJavaSuperClass.kt")
|
||||
public void testCharSequenceGetOverriddenInJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/charSequenceGetOverriddenInJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mapEntry.kt")
|
||||
public void testMapEntry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/mapEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("numberMixedHierarchy.kt")
|
||||
public void testNumberMixedHierarchy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/numberMixedHierarchy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaClass.kt")
|
||||
public void testRemoveAtBridgeToJavaClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaDefault.kt")
|
||||
public void testRemoveAtBridgeToJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaSuperClass.kt")
|
||||
public void testRemoveAtBridgeToJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToFakeRemoveAt.kt")
|
||||
public void testSuperCallToFakeRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToFakeRemoveAt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToRemoveAt.kt")
|
||||
public void testSuperCallToRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToRemoveAtInJavaDefault.kt")
|
||||
public void testSuperCallToRemoveAtInJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAtInJavaDefault.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -538,6 +538,12 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intArrayList.kt")
|
||||
public void testIntArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/intArrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44233.kt")
|
||||
public void testKt44233() throws Exception {
|
||||
|
||||
+65
-11
@@ -2736,54 +2736,108 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExtendJavaCollections {
|
||||
public class ExtendJavaClasses {
|
||||
@Test
|
||||
@TestMetadata("abstractList.kt")
|
||||
public void testAbstractList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("abstractMap.kt")
|
||||
public void testAbstractMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charSequenceGetOverriddenInJavaSuperClass.kt")
|
||||
public void testCharSequenceGetOverriddenInJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/charSequenceGetOverriddenInJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mapEntry.kt")
|
||||
public void testMapEntry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/mapEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("numberMixedHierarchy.kt")
|
||||
public void testNumberMixedHierarchy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/numberMixedHierarchy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaClass.kt")
|
||||
public void testRemoveAtBridgeToJavaClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaDefault.kt")
|
||||
public void testRemoveAtBridgeToJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaDefault.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("removeAtBridgeToJavaSuperClass.kt")
|
||||
public void testRemoveAtBridgeToJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToFakeRemoveAt.kt")
|
||||
public void testSuperCallToFakeRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToFakeRemoveAt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToRemoveAt.kt")
|
||||
public void testSuperCallToRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superCallToRemoveAtInJavaDefault.kt")
|
||||
public void testSuperCallToRemoveAtInJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAtInJavaDefault.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -586,6 +586,12 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intArrayList.kt")
|
||||
public void testIntArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/intArrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44233.kt")
|
||||
public void testKt44233() throws Exception {
|
||||
|
||||
+56
-11
@@ -2321,51 +2321,96 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExtendJavaCollections extends AbstractLightAnalysisModeTest {
|
||||
public static class ExtendJavaClasses extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("abstractList.kt")
|
||||
public void testAbstractList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("abstractMap.kt")
|
||||
public void testAbstractMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractMap.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("charSequenceGetOverriddenInJavaSuperClass.kt")
|
||||
public void testCharSequenceGetOverriddenInJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/charSequenceGetOverriddenInJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mapEntry.kt")
|
||||
public void testMapEntry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/mapEntry.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/mapEntry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberMixedHierarchy.kt")
|
||||
public void testNumberMixedHierarchy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/numberMixedHierarchy.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeAtBridgeToJavaClass.kt")
|
||||
public void testRemoveAtBridgeToJavaClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeAtBridgeToJavaDefault.kt")
|
||||
public void testRemoveAtBridgeToJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeAtBridgeToJavaSuperClass.kt")
|
||||
public void testRemoveAtBridgeToJavaSuperClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/removeAtBridgeToJavaSuperClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superCallToFakeRemoveAt.kt")
|
||||
public void testSuperCallToFakeRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToFakeRemoveAt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superCallToRemoveAt.kt")
|
||||
public void testSuperCallToRemoveAt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superCallToRemoveAtInJavaDefault.kt")
|
||||
public void testSuperCallToRemoveAtInJavaDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/superCallToRemoveAtInJavaDefault.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-8
@@ -1776,36 +1776,42 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExtendJavaCollections {
|
||||
public class ExtendJavaClasses {
|
||||
@Test
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-8
@@ -1818,36 +1818,42 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExtendJavaCollections {
|
||||
public class ExtendJavaClasses {
|
||||
@Test
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-8
@@ -1616,36 +1616,41 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExtendJavaCollections extends AbstractIrCodegenBoxWasmTest {
|
||||
public static class ExtendJavaClasses extends AbstractIrCodegenBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Generated
+14
-8
@@ -1862,38 +1862,44 @@ public class ExternalTestGenerated extends AbstractExternalNativeBlackBoxTest {
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections")
|
||||
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("external")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class ExtendJavaCollections {
|
||||
public class ExtendJavaClasses {
|
||||
@Test
|
||||
@TestMetadata("abstractSet.kt")
|
||||
public void testAbstractSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/abstractSet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInExtendJavaCollections() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
public void testAllFilesPresentInExtendJavaClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayList.kt")
|
||||
public void testArrayList() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/arrayList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extendArrayListThroughKotlin.kt")
|
||||
public void testExtendArrayListThroughKotlin() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/extendArrayListThroughKotlin.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashMap.kt")
|
||||
public void testHashMap() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashMap.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hashSet.kt")
|
||||
public void testHashSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt");
|
||||
runTest("compiler/testData/codegen/box/builtinStubMethods/extendJavaClasses/hashSet.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user