Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.14
Description
Suppose you have:
public interface MyInterface { default String getFoo() { return "foo"; } }
and a Groovy class implementing it:
@CompileStatic class MyClass implements MyInterface { @Overridde String getFoo() { return MyInterface.super.getFoo(); } }
This produces multiple compiler errors, like:
- Groovy:[Static type checking] - No such property: super for class: java.lang.Class <MyInterface> - Groovy:The usage of 'Class.this' and 'Class.super' is only allowed in nested/inner classes
If I replace it with:
@CompileStatic class MyClass implements MyInterface { @Overridde String getFoo() { return super.getFoo(); } }
I get:
Groovy:[Static type checking] - Cannot find matching method java.lang.Object#getFoo(). Please check if the declared type is correct and if the method exists
I find no way to properly override a default method while calling the super implementation.
Attachments
Issue Links
- relates to
-
GROOVY-10494 Groovy 4 can not compile super.foo with generic interface (or trait) method
- Closed