[
https://issues.apache.org/jira/browse/GROOVY-7036?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15073288#comment-15073288
]
Shil Sinha commented on GROOVY-7036:
------------------------------------
The example in the description can be simplified by removing the generics e.g.
{code}
interface TemplatedInterface {
String execute(Map argument)
}
class TemplatedInterfaceImplementation implements TemplatedInterface {
@Override
String execute(Map argument = [:]) {
return null
}
}
{code}
The issue is that the annotations on a method with default parameters are all
added to the methods generated by the verifier, even if they don't apply. In
this case, the generated method {{TemplatedInterfaceImplementation#execute()}}
has an @Override annotation, resulting in the error described.
> An interface implementation (override) with a method including a default
> parameter value does not compile
> ---------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-7036
> URL: https://issues.apache.org/jira/browse/GROOVY-7036
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.3.6
> Environment: JDK 1.7.0_60
> Reporter: Martin Ahrer
>
> A complete (gradle based) project to demonstrate the problem has been
> provided at https://github.com/MartinAhrer/bug-groovy-2.3-override.
> {code}
> interface TemplatedInterface<T> {
> T execute(Map argument)
> }
> class TemplatedInterfaceImplementation implements TemplatedInterface<String>{
> // This won't compile with groovy 2.3.x when adding a default argument
> value
> @Override
> String execute(Map argument = [:]) {
> return null
> }
> }
> {code}
> This kind of relates to GROOVY-6654.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)