diff --git a/java/ql/test/library-tests/multiply-bounded-wildcards/Test.java b/java/ql/test/library-tests/multiply-bounded-wildcards/Test.java new file mode 100644 index 00000000000..69e35b45b39 --- /dev/null +++ b/java/ql/test/library-tests/multiply-bounded-wildcards/Test.java @@ -0,0 +1,19 @@ +public class Test { + + static class BoundedGeneric { + public T getter(int unused) { return null; } + public void setter(T t) { } + } + + public static BoundedGeneric getUnbounded() { return null; } + + public static BoundedGeneric getLowerBounded() { return null; } + + public static void test() { + CharSequence cs = getUnbounded().getter(0); + Object o = getLowerBounded().getter(0); + getUnbounded().setter(null); + getLowerBounded().setter(null); + } + +} diff --git a/java/ql/test/library-tests/multiply-bounded-wildcards/test.expected b/java/ql/test/library-tests/multiply-bounded-wildcards/test.expected new file mode 100644 index 00000000000..ce09da85f2d --- /dev/null +++ b/java/ql/test/library-tests/multiply-bounded-wildcards/test.expected @@ -0,0 +1,4 @@ +| Test$BoundedGeneric.class:0:0:0:0 | getter | Test$BoundedGeneric.class:0:0:0:0 | BoundedGeneric | CharSequence | int | +| Test$BoundedGeneric.class:0:0:0:0 | getter | Test$BoundedGeneric.class:0:0:0:0 | BoundedGeneric | CharSequence | int | +| Test$BoundedGeneric.class:0:0:0:0 | setter | Test$BoundedGeneric.class:0:0:0:0 | BoundedGeneric | void | String | +| Test$BoundedGeneric.class:0:0:0:0 | setter | Test$BoundedGeneric.class:0:0:0:0 | BoundedGeneric | void | | diff --git a/java/ql/test/library-tests/multiply-bounded-wildcards/test.ql b/java/ql/test/library-tests/multiply-bounded-wildcards/test.ql new file mode 100644 index 00000000000..16ec4617e0a --- /dev/null +++ b/java/ql/test/library-tests/multiply-bounded-wildcards/test.ql @@ -0,0 +1,5 @@ +import java + +from MethodAccess ma +select ma.getCallee(), ma.getCallee().getDeclaringType(), ma.getCallee().getReturnType().toString(), + ma.getCallee().getAParamType().toString() diff --git a/java/ql/test/library-tests/wildcards-and-captured-types/Test.java b/java/ql/test/library-tests/wildcards-and-captured-types/Test.java new file mode 100644 index 00000000000..1696a035fd6 --- /dev/null +++ b/java/ql/test/library-tests/wildcards-and-captured-types/Test.java @@ -0,0 +1,13 @@ +import java.util.Collection; + +public class Test { + + public Collection getCollection() { + return null; + } + + public void test() { + this.getCollection().isEmpty(); + } + +} diff --git a/java/ql/test/library-tests/wildcards-and-captured-types/test.expected b/java/ql/test/library-tests/wildcards-and-captured-types/test.expected new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/ql/test/library-tests/wildcards-and-captured-types/test.ql b/java/ql/test/library-tests/wildcards-and-captured-types/test.ql new file mode 100644 index 00000000000..3e28a2c1d67 --- /dev/null +++ b/java/ql/test/library-tests/wildcards-and-captured-types/test.ql @@ -0,0 +1,5 @@ +import java + +from Method m, Type t +where m.getAParamType() = t and t.toString().matches("%? super ? extends%") +select m, t