Load special override as HIDDEN in case of signature clash
#KT-10151 Fixed
This commit is contained in:
+10
-4
@@ -15,11 +15,17 @@ private object EmptyList : List<Nothing> {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val n = EmptyList as List<Any?>
|
||||
val n = EmptyList as List<String>
|
||||
|
||||
if (n.contains(null)) return "fail 1"
|
||||
if (n.indexOf(null) != -1) return "fail 2"
|
||||
if (n.lastIndexOf(null) != -1) return "fail 3"
|
||||
if (n.contains("")) return "fail 1"
|
||||
if (n.indexOf("") != -1) return "fail 2"
|
||||
if (n.lastIndexOf("") != -1) return "fail 3"
|
||||
|
||||
val nullAny = EmptyList as List<Any?>
|
||||
|
||||
if (nullAny.contains(null)) return "fail 4"
|
||||
if (nullAny.indexOf(null) != -1) return "fail 5"
|
||||
if (nullAny.lastIndexOf(null) != -1) return "fail 6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun box(): String {
|
||||
val cb: CharBuffer = CharBuffer.impl()
|
||||
|
||||
return cb.get(0).toString() + (cb as CharSequence).get(1).toString()
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import java.util.*;
|
||||
|
||||
public class J implements Container {
|
||||
final public String removeAt(int index) { return "abc"; }
|
||||
final public String removeAt(int index) { return "abc"; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.nio.CharBuffer
|
||||
|
||||
fun box(): String {
|
||||
val cb = CharBuffer.wrap("OK")
|
||||
cb.position(1)
|
||||
val o = cb[0]
|
||||
val k = (cb as CharSequence).get(0)
|
||||
return o.toString() + k
|
||||
}
|
||||
Reference in New Issue
Block a user