[
https://issues.apache.org/jira/browse/GROOVY-12188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18099029#comment-18099029
]
ASF GitHub Bot commented on GROOVY-12188:
-----------------------------------------
paulk-asert commented on PR #2733:
URL: https://github.com/apache/groovy/pull/2733#issuecomment-5075469012
Cherry-picked manually onto the GROOVY_5_0_X branch as the minimal fix. For
master, see #2734 which should be a better long-term fix. If no impacts from
the long-term fix are noticed on master, it would be a candidate for
back-porting to GROOVY_5_0_X.
GROOVY_5_0_X:
https://github.com/apache/groovy/commit/09a2d2f01015adc50708e366c6936164b462baab
Master:
https://github.com/apache/groovy/commit/361a02e91dfb33d794cfaa33db82c39262046d6a
> Incorrect "abstract method not implemented … same name but different return
> type" error for a valid covariant override
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12188
> URL: https://issues.apache.org/jira/browse/GROOVY-12188
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 5.0.7
> Reporter: Octavia Togami
> Assignee: Paul King
> Priority: Major
>
> The following code in a `Repro.groovy` will cause the error:
> {code:groovy}
> abstract class ProviderSpec<T> {
> abstract T someValue()
> }
> abstract class CollectionPropertySpec<C extends Collection<String>> extends
> ProviderSpec<C> {
> C someValue() { return null }
> static class Nested<T> {
> // This method is required to trigger the bug, for some reason.
> void trigger(Optional<T> p) { p.map { it } }
> }
> }
> class DefaultListPropertyTest extends CollectionPropertySpec<List<String>> {
> }
> {code}
> {code:sh}
> $ groovyc Repro.groovy
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> Repro.groovy: 2: Abstract method 'T someValue()' is not implemented but a
> method of the same name but different return type is defined: method 'C
> someValue()'
> @ line 2, column 5.
> abstract T someValue()
> ^
> 1 error
> {code}
> This worked fine in Groovy 4 and appears to be correct code as it compiles
> under {{javac}} as well.
> This was shrunk from real code in Gradle, located at
> https://github.com/gradle/gradle/blob/adbe2eb8a092ed6f92ea3d693d32769b553151e9/platforms/core-configuration/model-core/src/test/groovy/org/gradle/api/internal/provider/CollectionPropertySpec.groovy#L49
> .
--
This message was sent by Atlassian Jira
(v8.20.10#820010)