[
https://issues.apache.org/jira/browse/GROOVY-11975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Saravanan updated GROOVY-11975:
-------------------------------
Description:
{code:java}
package com.company.test
import groovy.transform.CompileStatic
@CompileStatic
interface IService {
default void save(T entity) {
System.out.println(entity);
}
}
@CompileStatic
class TestGenericGroovy implements IService {
void save(String entity) {
// IService.super.save(entity) // works
super.save(entity) // doesn't work: Groovyc: [Static type checking] -
Default method validate() requires qualified super
}
static void main(String[] args) {
new TestGenericGroovy().save("test")
}
}
{code}
was:
{code:java}
package com.company.test
import groovy.transform.CompileStatic
@CompileStatic
interface IService<T> {
default void save(T entity) {
System.out.println(entity);
}
}
@CompileStatic
interface IServiceString {
default void save(String entity) {
System.out.println(entity);
}
}
@CompileStatic
class TestGenericGroovy implements IService<String> {
void save(String entity) {
// IService<String>.super.save(entity) // works
super.save(entity) // doesn't work: Groovyc: [Static type checking] -
Abstract method save(T) cannot be called directly
}
static void main(String[] args) {
new TestGenericGroovy().save("test")
}
}
{code}
> CLONE - Groovy 5 can not compile super.foo with default interface method
> ------------------------------------------------------------------------
>
> Key: GROOVY-11975
> URL: https://issues.apache.org/jira/browse/GROOVY-11975
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.0
> Reporter: Saravanan
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.2, 3.0.20
>
>
> {code:java}
> package com.company.test
> import groovy.transform.CompileStatic
> @CompileStatic
> interface IService {
> default void save(T entity) {
> System.out.println(entity);
> }
> }
> @CompileStatic
> class TestGenericGroovy implements IService {
> void save(String entity) {
> // IService.super.save(entity) // works
> super.save(entity) // doesn't work: Groovyc: [Static type checking] -
> Default method validate() requires qualified super
> }
> static void main(String[] args) {
> new TestGenericGroovy().save("test")
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)