blob: f19e9c6f57bca1c338b2b6bc9071e3781a3e5324 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.utils.util;
/**
* To avoid having to catch clone not supported exception everywhere, and create code with lack of
* coverage, this class exist to hide the clone not supported exceptions that should never happen.
*/
public class CertainlyCloneable<T> implements Cloneable {
@Override
public Object clone() {
try{
return callParentClone();
} catch (CloneNotSupportedException e) {
// Super clone should never throw exception for objects that should certainly be cloneable.
throw new Error(e);
}
}
protected Object callParentClone() throws CloneNotSupportedException {
return super.clone();
}
}
|