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?
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 {
...
}
}
From your telling:
try {
super.finalize();
} finally {
... // your code
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.