Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.8
-
None
Description
The following code compiles on groovy 2 but does not compile on groovy 3
package a.b.c import groovy.transform.CompileStatic @CompileStatic class ABC implements DEF { public double[] _array ABC() { } DEF clone() { ABC abc = (ABC) super.clone() abc._array = _array.clone() as double[] return abc } } public interface DEF extends Cloneable { public DEF clone() throws CloneNotSupportedException; }
It gives the following error message:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: ABC.groovy: 15: Method clone is protected in java.lang.Object @ line 15, column 22. abc._array = _array.clone() as double[] ^ 1 error
However if I don't put the class in a package (i.e. remove package a.b.c) it compiles fine.
(this might relate to this issue GROOVY-9874)
Attachments
Issue Links
- relates to
-
GROOVY-10070 Groovy classes (for Groovy < 4) cannot access protected methods from base classes under Java 16
- Closed
-
GROOVY-10733 Fix illegal access for array clone on JDK16+
- Closed
-
GROOVY-10931 Remove $getLookup method generation (Groovy 4+)
- Closed