#972 clone function does not call super.clone()

open
nobody
General (896)
5
2012-11-27
2009-12-15
No

Two instances there are clone methods that do not call the super.clone() method.
In:
org.jfree.chart.urls.CustomPieURLGenerator.clone()
org.jfree.data.time.TimePeriodValues.clone()

This non-final class defines a clone() method that does not call super.clone(). If this class ("A") is extended by a subclass ("B"), and the subclass B calls super.clone(), then it is likely that B's clone() method will return an object of type A, which violates the standard contract for clone().

If all clone() methods call super.clone(), then they are guaranteed to use Object.clone(), which always returns an object of the correct type.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks