Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.7.6
-
None
-
None
Description
Issue GROOVY-2837 reported a problem where Groovy compiler failed if you tried to extend a Java class with:
public final Object getProperty(String s)
It looks like that has been fixed but the following case still fails:
public final String getProperty(String s)
Unfortunately the Java class is within a third-party library so I can't change it.
Code to Reproduce the problem
$ 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; } }
$ head *.groovy ==> Groovy1.groovy <== class Groovy1 extends Java1 { } ==> Groovy2.groovy <== class Groovy2 extends Java2 { }
$ 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