6968584: Thread should not be Cloneable
authorchegar
Mon, 23 Aug 2010 14:35:22 +0100
changeset 6316 6d91c1ceac26
parent 6315 a02eddc607b7
child 6317 8046f5f96da1
6968584: Thread should not be Cloneable Reviewed-by: dholmes
jdk/src/share/classes/java/lang/Thread.java
--- a/jdk/src/share/classes/java/lang/Thread.java	Fri Aug 20 08:49:48 2010 -0700
+++ b/jdk/src/share/classes/java/lang/Thread.java	Mon Aug 23 14:35:22 2010 +0100
@@ -414,6 +414,18 @@
     }
 
     /**
+     * Throws CloneNotSupportedException as a Thread can not be meaningfully
+     * cloned. Construct a new Thread instead.
+     *
+     * @throws  CloneNotSupportedException
+     *          always
+     */
+    @Override
+    protected Object clone() throws CloneNotSupportedException {
+        throw new CloneNotSupportedException();
+    }
+
+    /**
      * Allocates a new {@code Thread} object. This constructor has the same
      * effect as {@linkplain #Thread(ThreadGroup,Runnable,String) Thread}
      * {@code (null, null, gname)}, where {@code gname} is a newly generated