Update S1113: exception case for the finalizer attack #3687

This commit is contained in:
Angelo Buono 2024-02-26 17:10:45 +01:00 committed by GitHub
parent 5bea4e0f11
commit 0a7352fa9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,13 +23,16 @@ More unexpected issues can be caused by relying on the `finalize()` method to pe
public class MyClass {
@Override
protected void finalize() {
releaseSomeResources(); // Noncompliant
protected void finalize() { // Noncompliant
releaseSomeResources();
}
}
----
=== Exceptions
It is allowed to override the `finalize()` method as `final` method with an empty body, to prevent the _finalizer attack_ as described in _MET12-J-EX1_.
== Resources