Load special override as HIDDEN in case of signature clash

#KT-10151 Fixed
This commit is contained in:
Denis Zharkov
2015-12-09 14:09:38 +03:00
parent 45c0bc3610
commit 871fe7680b
40 changed files with 445 additions and 51 deletions

View File

@@ -0,0 +1,27 @@
public abstract class CharBuffer implements CharSequence {
public final int length() {
return 0;
}
public final char charAt(int index) {
return 'K';
}
// The key problem here is that `get` has the same signature as kotlin.CharSequence.get but completely different semantics
public abstract char get(int index);
public abstract CharBuffer subSequence(int start, int end);
public static CharBuffer impl() {
return new CharBuffer() {
@Override
public char get(int index) {
return 'O';
}
@Override
public CharBuffer subSequence(int start, int end) {
return null;
}
};
}
}

View File

@@ -0,0 +1,5 @@
fun box(): String {
val cb: CharBuffer = CharBuffer.impl()
return cb.get(0).toString() + (cb as CharSequence).get(1).toString()
}