This question is very like the other one discussing Explicitly calling a default method in Java, but in Groovy code(ver. 2.4.16)
public interface Interface { // a Java interface
default void call() {}
}
public class Test implements Interface { // a Groovy class
@Override
public void call() {
Interface.super.call() // compile error: Groovy:The usage of 'Class.this' and 'Class.super' is only allowed in nested/inner classes.
}
}
On the other hand, default methods are very like Trait in Groovy, and the following code compiles OK
public trait Trait { // a Groovy trait
void call() {}
}
public class Test implements Trait { // a Groovy class
@Override
public void call() {
Trait.super.call() // compiles OK
}
}
So, how to explicitly call a default method in a Groovy subclass?