From d0452ab85988d1e61f413d102c48150acecdcd42 Mon Sep 17 00:00:00 2001 From: Gijs de Jong Date: Mon, 22 May 2023 13:16:43 +0200 Subject: [PATCH] Add test for type arguments in constructor --- .../matchers/HasTypeArgumentsTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/HasTypeArgumentsTest.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/HasTypeArgumentsTest.java index 608aed2767..1d7426d2d1 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/HasTypeArgumentsTest.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/HasTypeArgumentsTest.java @@ -30,6 +30,10 @@ void matches() { " return new ArrayList<>();", " }", "", + " Foo negative4() {", + " return new Foo(\"foo\");", + " }", + "", " ImmutableSet positive1() {", " // BUG: Diagnostic contains:", " return ImmutableSet.builder().build();", @@ -40,9 +44,26 @@ void matches() { " return new ImmutableSet.Builder().build();", " }", "", + " Foo positive3() {", + " // BUG: Diagnostic contains:", + " return new >Foo(List.of());", + " }", + "", " private static T alwaysNull() {", " return null;", " }", + "", + " public static class Foo {", + " private final Object value;", + "", + " public Foo(Object value) {", + " this.value = value;", + " }", + "", + " public > Foo(E value) {", + " this.value = value;", + " }", + " }", "}") .doTest(); }