Skip to content

Commit

Permalink
GROOVY-10379
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Nov 26, 2021
1 parent bc05754 commit 363d640
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6752,4 +6752,38 @@ public void testCompileStatic10377() {
checkDisassemblyFor("Main.class", "if_acmpne"); // ===
checkDisassemblyFor("Main.class", "if_acmpeq"); // !==
}

@Test
public void testCompileStatic10379() {
//@formatter:off
String[] sources = {
"Main.groovy",
"@groovy.transform.CompileStatic\n" +
"class C extends p.A {\n" +
" void test() {\n" +
" m('')\n" +
" }\n" +
"}\n" +
"new C().test()\n",

"p/A.groovy",
"package p\n" +
"abstract class A implements I {\n" +
" static void m(Number n) {\n" +
" print 'number'\n" +
" }\n" +
"}\n",

"p/I.java",
"package p;\n" +
"public interface I {\n" +
" default void m(String s) {\n" +
" System.out.print(\"string\");\n" +
" }\n" +
"}\n",
};
//@formatter:on

runConformTest(sources, "string");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,15 @@ public boolean hasPossibleMethod(final String name, final Expression arguments)
return true;
}
}
// GRECLIPSE add -- GROOVY-10379
for (ClassNode in : cn.getAllInterfaces()) {
for (MethodNode mn : in.getDeclaredMethods(name)) {
if (mn.isDefault() && hasCompatibleNumberOfArgs(mn, count)) {
return true;
}
}
}
// GRECLIPSE end
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,15 @@ public boolean hasPossibleMethod(final String name, final Expression arguments)
return true;
}
}
// GRECLIPSE add -- GROOVY-10379
for (ClassNode in : cn.getAllInterfaces()) {
for (MethodNode mn : in.getDeclaredMethods(name)) {
if (mn.isDefault() && hasCompatibleNumberOfArgs(mn, count)) {
return true;
}
}
}
// GRECLIPSE end
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ public boolean hasPossibleMethod(final String name, final Expression arguments)
return true;
}
}
// GRECLIPSE add -- GROOVY-9737
// GRECLIPSE add -- GROOVY-10379
for (ClassNode in : cn.getAllInterfaces()) {
for (MethodNode mn : in.getDeclaredMethods(name)) {
if (mn.isDefault() && hasCompatibleNumberOfArgs(mn, count)) {
Expand Down

0 comments on commit 363d640

Please sign in to comment.