mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-27 01:42:17 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
20 lines
672 B
HTML
20 lines
672 B
HTML
<html>
|
|
<body>
|
|
Reports <code>clone()</code> methods without the <code>final</code> modifier.
|
|
<p>
|
|
Since <code>clone()</code> can be used to instantiate objects without using a constructor, allowing the <code>clone()</code>
|
|
method to be overridden may result in corrupted objects, and even in security exploits. This may be prevented by making the
|
|
<code>clone()</code> method or the enclosing class itself <code>final</code>.
|
|
</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class Main implements Cloneable {
|
|
@Override
|
|
protected Object clone() throws CloneNotSupportedException {
|
|
return super.clone();
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |