From 5a151a965c2b39b9f19037c1491a260e1d25371e Mon Sep 17 00:00:00 2001 From: Till Schnell Date: Tue, 13 Apr 2021 11:57:10 +0200 Subject: [PATCH] Add new test classes --- .../TestClassWildcardsParamType.java | 23 +++++++++++++++++++ .../TestClassWildcardsSingle.java | 3 --- .../TestClassWildcardsSingleLib.java | 10 ++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/inferWildcards/TestClassWildcardsParamType.java create mode 100644 src/test/resources/inferWildcards/TestClassWildcardsSingleLib.java diff --git a/src/test/resources/inferWildcards/TestClassWildcardsParamType.java b/src/test/resources/inferWildcards/TestClassWildcardsParamType.java new file mode 100644 index 00000000..702440d7 --- /dev/null +++ b/src/test/resources/inferWildcards/TestClassWildcardsParamType.java @@ -0,0 +1,23 @@ +import java.util.List; +import java.lang.String; + +public final class TestClassWildcardsParamType { + public final T1 first; + public final T2 second; + + public TestClassWildcardsParamType(T1 first, T2 second) { + this.first = first; + this.second = second; + } + + public static TestClassWildcardsParamType of(T1 first, T2 second) { + return new TestClassWildcardsParamType(first, second); + } + + public static void main(String[] agrs) { + TestClassWildcardsParamType, String> pair = TestClassWildcardsParamType.of(List.class, "hello"); + + //Outout of compiler + //TestClassWildcardsParamType, String> pair = TestClassWildcardsParamType.of(List.class, "hello"); + } +} \ No newline at end of file diff --git a/src/test/resources/inferWildcards/TestClassWildcardsSingle.java b/src/test/resources/inferWildcards/TestClassWildcardsSingle.java index b9af5a46..8b391975 100644 --- a/src/test/resources/inferWildcards/TestClassWildcardsSingle.java +++ b/src/test/resources/inferWildcards/TestClassWildcardsSingle.java @@ -5,9 +5,6 @@ import java.lang.Object; class TestClassWildcardsSingle { - public TestClassWildcards () { - } - /** * Non working method in normal Java * @param input diff --git a/src/test/resources/inferWildcards/TestClassWildcardsSingleLib.java b/src/test/resources/inferWildcards/TestClassWildcardsSingleLib.java new file mode 100644 index 00000000..0cf2c938 --- /dev/null +++ b/src/test/resources/inferWildcards/TestClassWildcardsSingleLib.java @@ -0,0 +1,10 @@ +import java.util.List; + +class TestClassWildcardsLib +{ + + public List merge (List l1, List l2) { + l2.forEach(s -> {if(!l1.contains(s)) l1.add(s);}); + return l2; + } +} \ No newline at end of file