Files
codeql/java/ql/test/library-tests/multiply-bounded-wildcards/Test.java
Chris Smowton d999c1d3dd Java: Add test for multiply-bounded wildcards
This exercises several cases of variables bounded both by a wildcard and by a bound on the type parameter, checking that the extractor strips the wildcards and captures to decide on a concrete type for the parameters and return values.
2022-11-07 10:29:04 +00:00

20 lines
511 B
Java

public class Test {
static class BoundedGeneric<T extends CharSequence> {
public T getter(int unused) { return null; }
public void setter(T t) { }
}
public static BoundedGeneric<?> getUnbounded() { return null; }
public static BoundedGeneric<? super String> getLowerBounded() { return null; }
public static void test() {
CharSequence cs = getUnbounded().getter(0);
Object o = getLowerBounded().getter(0);
getUnbounded().setter(null);
getLowerBounded().setter(null);
}
}