mirror of
https://github.com/github/codeql.git
synced 2026-02-20 00:43:44 +01:00
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.
20 lines
511 B
Java
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);
|
|
}
|
|
|
|
}
|