You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/05 20:20:00 UTC
[jira] [Resolved] (GROOVY-6487) Compile error on class that
overrides a method with return type that extends a class and implements an
interface
[ https://issues.apache.org/jira/browse/GROOVY-6487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-6487.
---------------------------------
Resolution: Fixed
Works in Groovy 2.5+
> Compile error on class that overrides a method with return type that extends a class and implements an interface
> ----------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-6487
> URL: https://issues.apache.org/jira/browse/GROOVY-6487
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.1.9, 2.2.1, 2.4.0-beta-3
> Environment: OpenSUSE 12.3 i586, OpenJDK 1.7u45
> Reporter: Dmitry Ovchinnikov
> Priority: Major
> Attachments: Bug1.groovy, Bug1.java
>
>
> This code
> interface T {
> }
> interface X {
> T getT();
> }
> class C1 {
> public Properties getT() {
> return null;
> }
> }
> class PT extends Properties implements T {
> }
> class C2 extends C1 implements X {
> @Override
> public PT getT() {
> return null;
> }
> }
> provokes the following error:
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Bug1.groovy: 11: The return type of java.util.Properties getT() in C1 is incompatible with T getT() in X
> . At [11:2] @ line 11, column 2.
> public Properties getT() {
> ^
> 1 error
> but the same code in Java is OK.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)