jakartaee / mail-api

Jakarta Mail Specification project
https://jakartaee.github.io/mail-api
Other
244 stars 101 forks source link

finalize() in java.lang.Object has been deprecated #720

Open jmehrens opened 7 months ago

jmehrens commented 7 months ago

The finalize() in java.lang.Object has been deprecated in JDK 9. Various classes in JakartaMail implement a finalizer that should simply be removed.

This ticket can only be completed once https://github.com/jakartaee/mail-api/issues/709 is completed.

Goals for this ticket would be:

  1. Remove all finalizer methods from classes.
  2. Ensure that the existing close method for that class has the proper try/finally to ensure no unexpected failure prevent freeing the resource. Most classes need to be updated to cover this case.