From e877967a6296a7ba2852d317e47d80adb07dfc29 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 4 Nov 2022 13:46:01 +0000 Subject: [PATCH] Add test verifying no malformed wildcards result from captured type variables with a Collection type --- .../wildcards-and-captured-types/Test.java | 13 +++++++++++++ .../wildcards-and-captured-types/test.expected | 0 .../wildcards-and-captured-types/test.ql | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 java/ql/test/library-tests/wildcards-and-captured-types/Test.java create mode 100644 java/ql/test/library-tests/wildcards-and-captured-types/test.expected create mode 100644 java/ql/test/library-tests/wildcards-and-captured-types/test.ql 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