Inspectopedia
 
2024.3

'clone()' instantiates objects with constructor

Warning
New
Last modified: 03 December 2024

Reports calls to object constructors inside clone() methods.

It is considered good practice to call clone() to instantiate objects inside of a clone() method instead of creating them directly to support later subclassing. This inspection will not report clone() methods declared as final or clone() methods on final classes.