Skip to content

Commit

Permalink
Update S1113: exception case for the finalizer attack #3687
Browse files Browse the repository at this point in the history
  • Loading branch information
ADarko22 authored Feb 26, 2024
1 parent 5bea4e0 commit 0a7352f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rules/S1113/java/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0a7352f

Please sign in to comment.