45018ea468
Some of the changed data is correct, but some diagnostics are incorrect Corner cases like having both contains(Object) and contains(String) within implementation of Collection<String> is not supported
86 lines
1.4 KiB
Kotlin
Vendored
86 lines
1.4 KiB
Kotlin
Vendored
// FILE: CollectionStringImpl.java
|
|
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
|
|
public class CollectionStringImpl implements Collection<String> {
|
|
@Override
|
|
public int size() {
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public boolean isEmpty() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean contains(Object o) {
|
|
return false;
|
|
}
|
|
|
|
|
|
@Override
|
|
public Iterator<String> iterator() {
|
|
return null;
|
|
}
|
|
|
|
|
|
@Override
|
|
public Object[] toArray() {
|
|
return new Object[0];
|
|
}
|
|
|
|
|
|
@Override
|
|
public <T> T[] toArray(T[] a) {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public boolean add(String s) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean remove(Object o) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean containsAll(Collection<?> c) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean addAll(Collection<? extends String> c) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean removeAll(Collection<?> c) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean retainAll(Collection<?> c) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public void clear() {
|
|
|
|
}
|
|
|
|
public boolean contains(String o) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// FILE: main.kt
|
|
|
|
fun test(x: CollectionStringImpl) {
|
|
x.contains("")
|
|
(x as Collection<String>).contains("")
|
|
}
|