Skip to content

Commit 9ddae89

Browse files
committed
GROOVY-9762
1 parent 8c93936 commit 9ddae89

File tree

3 files changed

+422
-0
lines changed

3 files changed

+422
-0
lines changed

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

+23
Original file line numberDiff line numberDiff line change
@@ -5119,4 +5119,27 @@ public void testCompileStatic9734() {
51195119

51205120
runConformTest(sources, "");
51215121
}
5122+
5123+
@Test
5124+
public void testCompileStatic9762() {
5125+
assumeTrue(isParrotParser());
5126+
5127+
//@formatter:off
5128+
String[] sources = {
5129+
"Script.groovy",
5130+
"static <T> List<T> list(T item) {\n" +
5131+
" return [item]\n" +
5132+
"}\n" +
5133+
"@groovy.transform.CompileStatic\n" +
5134+
"void test() {\n" +
5135+
" Optional<Integer> opt = Optional.ofNullable(123)\n" +
5136+
" List<Integer> result = opt.map(this::list).get()\n" +
5137+
" print result\n" +
5138+
"}\n" +
5139+
"test()\n",
5140+
};
5141+
//@formatter:on
5142+
5143+
runConformTest(sources, "[123]");
5144+
}
51225145
}

base/org.codehaus.groovy30/.checkstyle

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<file-match-pattern match-pattern="groovy/classgen/Verifier.java" include-pattern="false" />
4747
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticInvocationWriter.java" include-pattern="false" />
4848
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticPropertyAccessHelper.java" include-pattern="false" />
49+
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticTypesMethodReferenceExpressionWriter.java" include-pattern="false" />
4950
<file-match-pattern match-pattern="groovy/control/CompilationUnit.java" include-pattern="false" />
5051
<file-match-pattern match-pattern="groovy/control/CompilerConfiguration.java" include-pattern="false" />
5152
<file-match-pattern match-pattern="groovy/control/ErrorCollector.java" include-pattern="false" />

0 commit comments

Comments
 (0)