mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
22 lines
769 B
HTML
22 lines
769 B
HTML
<html>
|
|
<body>
|
|
Reports implementations of, and calls to, the <code>clone()</code> method and uses of the <code>java.lang.Cloneable</code> interface.
|
|
<p>Some coding standards prohibit the use of <code>clone()</code>, and recommend using a copy constructor or
|
|
a <code>static</code> factory method instead.</p>
|
|
<p>The inspection ignores calls to <code>clone()</code> on arrays because it's a correct and compact way to copy an array.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class Copy implements Cloneable /*warning*/ {
|
|
|
|
public Copy clone() /*warning*/ {
|
|
try {
|
|
return (Copy) super.clone(); // warning
|
|
} catch (CloneNotSupportedException e) {
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |