Reputation: 8653
I have finalize
method in my project(I know finalize
should not be used, but can not change logic now.) FindBugs gives error that super.finalize()
should be called, but if that is done and Throwable
is catched (which should not be done either), FindBugs gives another error, stating Throwable
should not be catched.
I can not throw Throwable
either, application may suffer.
Is there anyway out?
Upvotes: 1
Views: 111
Reputation: 1461
You have to throw Throwable
in your finalize
method. Here is the code of the method you need:
@Override
protected void finalize() throws Throwable
try {
super.finalize();
} finally {
...
}
}
Upvotes: 2
Reputation: 109577
From your telling:
try {
super.finalize();
} finally {
... // your code
}
Upvotes: 1