mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8201793: (ref) Reference object should not support cloning
Reviewed-by: psandoz, kbarrett
This commit is contained in:
parent
8ebfc59cfa
commit
bd18ef4c18
2 changed files with 118 additions and 0 deletions
|
@ -300,6 +300,20 @@ public abstract class Reference<T> {
|
|||
return this.queue.enqueue(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws {@link CloneNotSupportedException}. A {@code Reference} cannot be
|
||||
* meaningfully cloned. Construct a new {@code Reference} instead.
|
||||
*
|
||||
* @returns never returns normally
|
||||
* @throws CloneNotSupportedException always
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
/* -- Constructors -- */
|
||||
|
||||
Reference(T referent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue