27 lines
616 B
Plaintext
27 lines
616 B
Plaintext
There is no point in setting class fields to ``++null++`` in a finalizer. If this this is a hint to the garbage collector, it is unnecessary - the object will be garbage collected anyway - and doing so may actually cause extra work for the garbage collector.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,java]
|
|
----
|
|
public class Foo {
|
|
private String name;
|
|
|
|
@Override
|
|
void finalize() {
|
|
name = null; // Noncompliant; completely unnecessary
|
|
}
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|