Community
Participate
Working Groups
Using the finalize() method can slow down GC and cause other memory problems. It should only be used as a last resort. Please remove the finalize() method from org.eclipse.jst.jee.archive.internal.ArchiveImpl Writing something to stderr does not seem like a strong enough reason to have this method.
I just noticed there is a close() in the finalize methods as well, so it is not quite a bad as I first thought. Please review if this is still needed, because relying on finalize to close your archive is not recommended.
seems like something Jason would know about
This is working as designed. The finalize() method was put in place in order to help facilitate proper usage of the IArchive API. Too often developers using the API forget to follow this pattern and fail to close the archive. IArchive archive try{ archive = //open the archive } finally{ if(archive != null) archive.close(); } This leads to open file handles which then require the entire workbench to be brought down in order to release the file handles. The finalize() method was put in place to do two things; 1. warn the developers with the exception to stderr that they forgot to close the archive, and 2. close the archive if it was orphaned. These precautions have helped track down many bugs, and unless there is another ensure archives are closed and developers are sternly reminded to close them, the finalize() method should remain.
(In reply to comment #3) Why does it write to syserr instead of a log?