You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/07/13 20:32:07 UTC

[jira] [Updated] (GROOVY-4744) Fail to extend Java class with public final String getProperty(String s)

     [ https://issues.apache.org/jira/browse/GROOVY-4744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pascal Schumacher updated GROOVY-4744:
--------------------------------------
    Fix Version/s:     (was: 2.3.x)

> Fail to extend Java class with public final String getProperty(String s)
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-4744
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4744
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 1.7.6
>            Reporter: Paul Cager
>
> Issue [http://jira.codehaus.org/browse/GROOVY-2837] reported a problem where Groovy compiler failed if you tried to extend a Java class with:
>     {code}public final Object getProperty(String s){code}
> It looks like that has been fixed but the following case still fails:
>     {code}public final String getProperty(String s){code}
> Unfortunately the Java class is within a third-party library so I can't change it.
> h4. Code to Reproduce the problem
> {code}
> $ head *.java
> ==> Java1.java <==
> public class Java1 {
>   public final Object getProperty(String s) { return null; }
> }
> ==> Java2.java <==
> public class Java2 {
>   public final String getProperty(String s) { return null; }
> }
> {code}
> {code}
> $ head *.groovy
> ==> Groovy1.groovy <==
> class Groovy1 extends Java1 { }
> ==> Groovy2.groovy <==
> class Groovy2 extends Java2 { }
> {code}
> {code}
> $ javac *.java
> $ groovyc *.groovy
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Groovy2.groovy: -1: You are not allowed to override the final method getProperty(java.lang.String) from class 'Java2'.
>  @ line -1, column -1.
> 1 error
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)