[
https://issues.apache.org/jira/browse/GROOVY-8164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-8164:
--------------------------------
Labels: breaking (was: )
> Groovy allows a Java class to inherit static methods from its interface
> -----------------------------------------------------------------------
>
> Key: GROOVY-8164
> URL: https://issues.apache.org/jira/browse/GROOVY-8164
> Project: Groovy
> Issue Type: Bug
> Components: Compiler, Static compilation
> Affects Versions: 2.4.7
> Reporter: Dmitry Khamitov
> Assignee: Eric Milles
> Priority: Major
> Labels: breaking
> Fix For: 4.0.0-rc-2
>
>
> In the following situation Java doesn't compile (as per JLS8 - 8.4.8
> Inheritance, Overriding, and Hiding):
> {code:java}
> interface Foo {
> static void foo() {
> System.out.println("static void foo() called");
> }
> }
> class Bar implements Foo { }
> public class FooBarTest {
> public static void main(String[] args) {
> Bar.foo();
> }
> }
> {code}
> {code}
> $ javac FooBarTest.java
> FooBarTest.java:3: error: cannot find symbol
> Bar.foo();
> ^
> symbol: method foo()
> location: class Bar
> 1 error
> {code}
> But Groovy does compile, both dynamic and @CompileStatic and we get {{static
> void foo() called}} in the output
> Just in case, here is a snippet from _JLS8_:
> *8.4.8 Inheritance, Overriding, and Hiding*
> A class C inherits from its direct superclass all concrete methods m (both
> static and instance) of the superclass for which all of the following are
> true:
> ...
> A class does not inherit static methods from its superinterfaces.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)