Skip to content

Commit

Permalink
GROOVY-10234
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Sep 28, 2021
1 parent 97a285d commit 8328da8
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3575,6 +3575,34 @@ public void testTypeChecked10225() {
runConformTest(sources, "null");
}

@Test
public void testTypeChecked10234() {
//@formatter:off
String[] sources = {
"Main.groovy",
"def <T> T getBean(Class<T> beanType) {\n" +
" { obj, Class target -> Optional.of(obj.toString()) } as Service\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" print getBean(Service).convert(new ArrayList(), String).get()\n" +
"}\n" +
"test()\n",

"Service.java",
"import java.util.Optional;\n" +
"import java.util.function.*;\n" +
"@SuppressWarnings(\"rawtypes\")" +
"public interface Service<Impl extends Service> {\n" +
" <T> Optional<T> convert(Object object, Class<T> targetType);\n" +
" <S, T> Impl addConverter(Class<S> sourceType, Class<T> targetType, Function<S, T> typeConverter);\n" +
"}\n",
};
//@formatter:on

runConformTest(sources, "[]");
}

@Test
public void testTypeChecked10235() {
if (Float.parseFloat(System.getProperty("java.specification.version")) > 8)
Expand Down

0 comments on commit 8328da8

Please sign in to comment.