jai-imageio / jai-imageio-jpeg2000

JPEG2000 support for Java Advanced Imaging Image I/O Tools API
Other
74 stars 56 forks source link

jj2000: Eliminate deprecation warnings #15

Closed rleigh-codelibre closed 4 years ago

rleigh-codelibre commented 7 years ago

From https://github.com/rleigh-codelibre/jai-tidy/commit/207963ba0ab525259ac0e31dd8b21f86bd4fcb2coriginating with https://github.com/openmicroscopy/bioformats/commit/297b1e61a0c27a88124fa3206cf27589936e9c99

/cc @melissalinkert @sbesson @jburel

rleigh-codelibre commented 7 years ago

This PR commented out the use of System.runFinalizersOnExit(true); in order to remove three deprecation warnings. However, this is likely inappropriate given that it's required for the DO_TIMING logic in the finalisers.

Removing the use of System.runFinalizersOnExit(true); would be desirable though. Is there any alternative way the profiling could report back the information. For example, would reporting each result separately to the logger, which could be aggregated once the profiling was complete, be an acceptable alternative?

mtbc commented 7 years ago

Maybe just before exit can make sure no references to these objects still exist (set to null or whatever) then,

System.gc();
System.runFinalization();

which is little less horrifying but not actually yet deprecated.

stain commented 6 years ago

As DO_TIMING = false the finalize requirement is only needed in the case that one is enabled in source code for manual profiling.

So perhaps just leave equivalently the runFinalizersOnExit line commented out (with a comment to turn on with DO_TIMING) right below inside a static{ } block?

rleigh-codelibre commented 4 years ago

I'm not doing work on this going forward. If anyone wants to pick this up, please feel free to do so.