26 lines
626 B
Plaintext
26 lines
626 B
Plaintext
![]() |
Overriding the Object.finalize() method should be done with caution and with a clear goal in mind so empty implementations or implementations containing only a call to 'super.finalize()' are useless and misleading.
|
||
|
|
||
|
|
||
|
The following code snippet illustrates this rule:
|
||
|
|
||
|
----
|
||
|
protected finalize() { //Non-Compliant
|
||
|
}
|
||
|
...
|
||
|
protected finalize() {
|
||
|
super.finalize(); //Non-Compliant
|
||
|
}
|
||
|
...
|
||
|
protected finalize() {
|
||
|
disposeSomeResources(); //Compliant
|
||
|
}
|
||
|
----
|
||
|
|
||
|
|
||
|
ifdef::env-github,rspecator-view[]
|
||
|
== Comments And Links
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::comments-and-links.adoc[]
|
||
|
endif::env-github,rspecator-view[]
|