Files
codeql/java/ql/test/kotlin/library-tests/inherited-collection-implementation/Test.java
Chris Smowton 8266a22332 Kotlin: fix method types when an inherited method implements a collection type
In this circumstance the compiler seems to generate a specialised version of the implementing function with its argument type replaced by the interface-implementing child class' type parameter. However it stores a back-pointer to the real declared function, which we should use as the call target.
2022-10-29 11:29:04 +01:00

60 lines
939 B
Java

import java.util.*;
public class Test {
public boolean contains(Object o) { return false; }
}
class SetImpl<T> extends Test implements Set<T> {
public int size() {
return 0;
}
public boolean isEmpty() {
return false;
}
public Iterator<T> iterator() {
return null;
}
public Object[] toArray() {
return new Object[0];
}
public <T1> T1[] toArray(T1[] a) {
return null;
}
public boolean add(T t) {
return false;
}
public boolean remove(Object o) {
return false;
}
public boolean containsAll(Collection<?> c) {
return false;
}
public boolean addAll(Collection<? extends T> c) {
return false;
}
public boolean retainAll(Collection<?> c) {
return false;
}
public boolean removeAll(Collection<?> c) {
return false;
}
public void clear() {
}
}