a750d9466e
The difference is how we deal with intermediate fake overrides
E.g., in case
interface A { /* $1 */ fun foo() }
interface B : A {
/* $2 */ fake_override fun foo()
}
interface C : B {
/* $3 */ override fun foo()
}
We've got FIR declarations only for $1 and $3, but we've got
a fake override for $2 in IR.
Previously, override $3 had $1 as its overridden IR symbol, just because
FIR declaration of $3 doesn't know anything about $2.
Now, when generating IR for $2, we save the necessary information
and using it for $3, so it has $2 as overridden.
So, it's consistent with the overridden structure of FE 1.0 and this
structure is necessary prerequisite for proper building of bridges
for special built-ins.
100 lines
2.0 KiB
Kotlin
Vendored
100 lines
2.0 KiB
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
// FILE: javaCollectionWithRemovePrimitiveInt.kt
|
|
|
|
fun box(): String {
|
|
val j = JIntCollection(arrayListOf(1, 2, 3))
|
|
j.remove(1) // remove(int)
|
|
if (j.removed != 1) throw AssertionError("${j.removed}")
|
|
return "OK"
|
|
}
|
|
|
|
// FILE: JIntCollection.java
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
|
|
public class JIntCollection implements Collection<Integer> {
|
|
private final Collection<Integer> collection;
|
|
public int removed = 0;
|
|
|
|
public JIntCollection(Collection<Integer> collection) {
|
|
this.collection = collection;
|
|
}
|
|
|
|
@Override
|
|
public int size() {
|
|
return collection.size();
|
|
}
|
|
|
|
@Override
|
|
public boolean isEmpty() {
|
|
return collection.isEmpty();
|
|
}
|
|
|
|
@Override
|
|
public boolean contains(Object o) {
|
|
return collection.contains(o);
|
|
}
|
|
|
|
@NotNull
|
|
@Override
|
|
public Iterator<Integer> iterator() {
|
|
return collection.iterator();
|
|
}
|
|
|
|
@NotNull
|
|
@Override
|
|
public Object[] toArray() {
|
|
return collection.toArray();
|
|
}
|
|
|
|
@NotNull
|
|
@Override
|
|
public <T> T[] toArray(@NotNull T[] a) {
|
|
return collection.toArray(a);
|
|
}
|
|
|
|
@Override
|
|
public boolean add(Integer integer) {
|
|
return collection.add(integer);
|
|
}
|
|
|
|
@Override
|
|
public boolean remove(Object o) {
|
|
return collection.remove(o);
|
|
}
|
|
|
|
public boolean remove(int x) {
|
|
removed = x;
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean containsAll(@NotNull Collection<?> c) {
|
|
return collection.containsAll(c);
|
|
}
|
|
|
|
@Override
|
|
public boolean addAll(@NotNull Collection<? extends Integer> c) {
|
|
return collection.addAll(c);
|
|
}
|
|
|
|
@Override
|
|
public boolean removeAll(@NotNull Collection<?> c) {
|
|
return collection.removeAll(c);
|
|
}
|
|
|
|
@Override
|
|
public boolean retainAll(@NotNull Collection<?> c) {
|
|
return collection.retainAll(c);
|
|
}
|
|
|
|
@Override
|
|
public void clear() {
|
|
collection.clear();
|
|
}
|
|
}
|