1

Any exception thrown by the {@code finalize} method causes the finalization of this object to be halted, but is otherwise ignored.

The first clause says, the finalization of this object could be halted. BUT I don't understand the "but is otherwise ignored".

"but" is the subject?
"is" is the verb?
"ignored" is the object?

2
  • 3
    "Exception" is the subject, as in, "any exception is ignored." As far as I can tell, the sentence means, "If the {@code finalize} method throws an exception, the finalization will be halted, but nothing else will happen." It is fairly confusing, though. – dinerdash Feb 11 '16 at 2:03
  • I think that the wording is poor. It seems to me that only exceptions thrown by the {@code finalize} would cause the finalization of this object to be halted, but any other exceptions would be ignored. – MaxW Feb 11 '16 at 7:15
1

Any exception thrown by the {@code finalize} method causes the finalization of this object to be halted, but is otherwise ignored.

Here I've reformatted the sentence to bring out the clauses better. We start with "any exception", then qualify it — only exceptions thrown by the finalize method are relevant here, nothing else is being discussed at all. Then we see what happens when these exceptions are thrown — they stop finalization. However, other than stopping finalization, those exceptions are ignored — they aren't handled by anything and cannot be further interacted with.

The last clause could be rephrased as a separate sentence:

Any such exception is otherwise ignored.

This is a passive construction with a subject phrase ("Any such exception") and a verb phrase ("is otherwise ignored"). (If it was rephrased to be active, the exceptions would be the object.)

1

In your example

but is otherwise ignored

the understood subject is the exception
the verb is is ignored

Your passage is explaining that when finalize() is called and an exception is encountered the object finalization process stops.

During finalization, all references to an object are broken (set to null) which then allows the memory to be freed up.

The implications are that references (links) to the object may still exist and this will not allow garbage collection to occur. In other words, you have a potential memory leak if this keeps happening.

The fact that it is otherwise ignored is not good if you wanted to have a callback to handle the original exception since some other method is necessary to trigger the callback.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.