[
https://issues.apache.org/jira/browse/GROOVY-11339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-11339.
----------------------------------
Fix Version/s: 5.0.0-alpha-9
Resolution: Fixed
https://github.com/apache/groovy/commit/98b07228366ded3390d9306a73013e547b610ba6
> AutoImplement and method with default arguments
> -----------------------------------------------
>
> Key: GROOVY-11339
> URL: https://issues.apache.org/jira/browse/GROOVY-11339
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-9
>
>
> Consider the following:
> {code:groovy}
> interface I {
> def foo(bar)
> def foo(bar,baz)
> // ...
> }
> @groovy.transform.AutoImplement
> class C implements I {
> @Override // foo(bar) and foo(bar,baz)
> def foo(bar, baz = null) {
> }
> }
> {code}
> We want to auto-implement most of {{I}} but explicitly provide an
> implementation for both {{foo}} methods. Compiler says "The method with
> default parameters "java.lang.Object foo(java.lang.Object, java.lang.Object)"
> defines a method "java.lang.Object foo(java.lang.Object)" that
> is already defined."
> Defining the overrides separately (no default generated method) works fine.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)