Skip to content

Commit 8328da8

Browse files
committed
GROOVY-10234
1 parent 97a285d commit 8328da8

File tree

1 file changed

+28
-0
lines changed
  • base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform

1 file changed

+28
-0
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java

+28
Original file line numberDiff line numberDiff line change
@@ -3575,6 +3575,34 @@ public void testTypeChecked10225() {
35753575
runConformTest(sources, "null");
35763576
}
35773577

3578+
@Test
3579+
public void testTypeChecked10234() {
3580+
//@formatter:off
3581+
String[] sources = {
3582+
"Main.groovy",
3583+
"def <T> T getBean(Class<T> beanType) {\n" +
3584+
" { obj, Class target -> Optional.of(obj.toString()) } as Service\n" +
3585+
"}\n" +
3586+
"@groovy.transform.TypeChecked\n" +
3587+
"void test() {\n" +
3588+
" print getBean(Service).convert(new ArrayList(), String).get()\n" +
3589+
"}\n" +
3590+
"test()\n",
3591+
3592+
"Service.java",
3593+
"import java.util.Optional;\n" +
3594+
"import java.util.function.*;\n" +
3595+
"@SuppressWarnings(\"rawtypes\")" +
3596+
"public interface Service<Impl extends Service> {\n" +
3597+
" <T> Optional<T> convert(Object object, Class<T> targetType);\n" +
3598+
" <S, T> Impl addConverter(Class<S> sourceType, Class<T> targetType, Function<S, T> typeConverter);\n" +
3599+
"}\n",
3600+
};
3601+
//@formatter:on
3602+
3603+
runConformTest(sources, "[]");
3604+
}
3605+
35783606
@Test
35793607
public void testTypeChecked10235() {
35803608
if (Float.parseFloat(System.getProperty("java.specification.version")) > 8)

0 commit comments

Comments
 (0)