Inspectopedia Help

Cloning issues

'clone()' does not declare 'CloneNotSupportedException'  

Reports clone() methods that do not declare throws CloneNotSupportedException.

'clone()' instantiates objects with constructor  

Reports calls to object constructors inside clone() methods.

'clone()' method in non-Cloneable class  

Reports classes that override the clone() method but don't implement the Cloneable interface.

'clone()' method not 'public'  

Reports clone() methods that are protected and not public.

'clone()' should have return type equal to the class it contains  

Reports clone() methods with return types different from the class they're located in.

Cloneable class without 'clone()' method  

Reports classes implementing the Cloneable interface that don't override the clone() method.

Use of 'clone()' or 'Cloneable'  

Reports implementations of, and calls to, the clone() method and uses of the java.lang.Cloneable interface.

Last modified: 18 June 2024