[ 
https://issues.apache.org/jira/browse/GROOVY-4744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149087#comment-18149087
 ] 

Daniel Sun commented on GROOVY-4744:
------------------------------------

Fixed on master; added a regression test in 
c31086d6ce6e969148459228bda11b6b2cddb9e7 
(https://github.com/apache/groovy/commit/c31086d6ce6e969148459228bda11b6b2cddb9e7).

> 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
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1
>
>
> Issue 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
(v10.3.26#10030026)

Reply via email to