diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java index 47d7f96c88..826b03afbe 100644 --- a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java +++ b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java @@ -5344,6 +5344,27 @@ public void testCompileStatic9799() { runConformTest(sources, "works"); } + @Test + public void testCompileStatic9860() { + //@formatter:off + String[] sources = { + "Main.groovy", + "@groovy.transform.CompileStatic\n" + + "class C {\n" + + " static void test() {\n" + + " def bind = { T a, T b ->\n" + + " return new Tuple2(a, b)\n" + + " }\n" + + " print bind('foo', 'bar')\n" + + " }\n" + + "}\n" + + "C.test()\n", + }; + //@formatter:on + + runConformTest(sources, "[foo, bar]"); + } + @Test public void testCompileStatic9863() { //@formatter:off diff --git a/base/org.codehaus.groovy30/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java b/base/org.codehaus.groovy30/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java index b96cce1cdd..5904a815d5 100644 --- a/base/org.codehaus.groovy30/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java +++ b/base/org.codehaus.groovy30/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java @@ -1131,8 +1131,11 @@ private static Parameter[] makeRawTypes(final Parameter[] parameters, final Map< String name = param.getType().getUnresolvedName(); Optional value = genericsPlaceholderAndTypeMap.entrySet().stream() .filter(e -> e.getKey().getName().equals(name)).findFirst().map(Map.Entry::getValue); + /* GRECLIPSE edit -- GROOVY-9860 ClassNode type = value.map(GenericsType::getType).orElseGet(() -> makeRawType(param.getType())); - + */ + ClassNode type = value.map(gt -> !gt.isPlaceholder() ? gt.getType() : makeRawType(gt.getType())).orElseGet(() -> makeRawType(param.getType())); + // GRECLIPSE end return new Parameter(type, param.getName()); }).toArray(Parameter[]::new); }