You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/06/29 14:31:00 UTC
[jira] [Resolved] (GROOVY-9170) The method clone should be public
as it implements the corresponding method from interface java.lang.Object
[ https://issues.apache.org/jira/browse/GROOVY-9170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Sun resolved GROOVY-9170.
--------------------------------
Resolution: Fixed
Assignee: Daniel Sun
Fix Version/s: 3.0.0-beta-2
2.5.8
The proposed PR was merged.
[https://github.com/apache/groovy/commit/3d03e2f4b31d7514a76f918dc6eb3308f599a3c1]
> The method clone should be public as it implements the corresponding method from interface java.lang.Object
> -----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-9170
> URL: https://issues.apache.org/jira/browse/GROOVY-9170
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.5.7
> Reporter: Mauro Molinari
> Assignee: Daniel Sun
> Priority: Major
> Fix For: 2.5.8, 3.0.0-beta-2
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> I have a class like the following:
> {code:groovy}
> @CompileStatic
> class MyClass implements Serializable, Cloneable {
> @Override
> protected Object clone() {
> super.clone()
> }
> }
> {code}
> When trying to compile this class I get the following error from the Groovy compiler: {{The method clone should be public as it implements the corresponding method from interface java.lang.Object}}.
> Apart from the fact that {{java.lang.Object}} is not an interface ;-) it doesn't make sense. {{java.lang.Object.clone()}} is {{protected}} so why can't I override it and keep it {{protected}}?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)