TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  CloneImplementation2Checked automatically with code checker

This rule is Obsolete
Synopsis:clone() method should throw CloneNotSupportedException
Language:Java
Severity Level:2
Category:CloneImplementation


Description:
The method clone() should throw a CloneNotSupportedException.
public class MyClass implements Cloneable{
     public Object clone() { // will cause an error
          MyClass clone = (MyClass)super.clone();
          return clone;
     }
 }