Skip to content

Commit 363d640

Browse files
committedNov 26, 2021
GROOVY-10379
1 parent bc05754 commit 363d640

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed
 

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

+34
Original file line numberDiff line numberDiff line change
@@ -6752,4 +6752,38 @@ public void testCompileStatic10377() {
67526752
checkDisassemblyFor("Main.class", "if_acmpne"); // ===
67536753
checkDisassemblyFor("Main.class", "if_acmpeq"); // !==
67546754
}
6755+
6756+
@Test
6757+
public void testCompileStatic10379() {
6758+
//@formatter:off
6759+
String[] sources = {
6760+
"Main.groovy",
6761+
"@groovy.transform.CompileStatic\n" +
6762+
"class C extends p.A {\n" +
6763+
" void test() {\n" +
6764+
" m('')\n" +
6765+
" }\n" +
6766+
"}\n" +
6767+
"new C().test()\n",
6768+
6769+
"p/A.groovy",
6770+
"package p\n" +
6771+
"abstract class A implements I {\n" +
6772+
" static void m(Number n) {\n" +
6773+
" print 'number'\n" +
6774+
" }\n" +
6775+
"}\n",
6776+
6777+
"p/I.java",
6778+
"package p;\n" +
6779+
"public interface I {\n" +
6780+
" default void m(String s) {\n" +
6781+
" System.out.print(\"string\");\n" +
6782+
" }\n" +
6783+
"}\n",
6784+
};
6785+
//@formatter:on
6786+
6787+
runConformTest(sources, "string");
6788+
}
67556789
}

‎base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassNode.java

+9
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,15 @@ public boolean hasPossibleMethod(final String name, final Expression arguments)
13211321
return true;
13221322
}
13231323
}
1324+
// GRECLIPSE add -- GROOVY-10379
1325+
for (ClassNode in : cn.getAllInterfaces()) {
1326+
for (MethodNode mn : in.getDeclaredMethods(name)) {
1327+
if (mn.isDefault() && hasCompatibleNumberOfArgs(mn, count)) {
1328+
return true;
1329+
}
1330+
}
1331+
}
1332+
// GRECLIPSE end
13241333
}
13251334

13261335
return false;

‎base/org.codehaus.groovy30/src/org/codehaus/groovy/ast/ClassNode.java

+9
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,15 @@ public boolean hasPossibleMethod(final String name, final Expression arguments)
13121312
return true;
13131313
}
13141314
}
1315+
// GRECLIPSE add -- GROOVY-10379
1316+
for (ClassNode in : cn.getAllInterfaces()) {
1317+
for (MethodNode mn : in.getDeclaredMethods(name)) {
1318+
if (mn.isDefault() && hasCompatibleNumberOfArgs(mn, count)) {
1319+
return true;
1320+
}
1321+
}
1322+
}
1323+
// GRECLIPSE end
13151324
}
13161325

13171326
return false;

‎base/org.codehaus.groovy40/src/org/codehaus/groovy/ast/ClassNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ public boolean hasPossibleMethod(final String name, final Expression arguments)
13371337
return true;
13381338
}
13391339
}
1340-
// GRECLIPSE add -- GROOVY-9737
1340+
// GRECLIPSE add -- GROOVY-10379
13411341
for (ClassNode in : cn.getAllInterfaces()) {
13421342
for (MethodNode mn : in.getDeclaredMethods(name)) {
13431343
if (mn.isDefault() && hasCompatibleNumberOfArgs(mn, count)) {

0 commit comments

Comments
 (0)
Please sign in to comment.