ome / bioformats

Bio-Formats is a Java library for reading and writing data in life sciences image file formats. It is developed by the Open Microscopy Environment. Bio-Formats is released under the GNU General Public License (GPL); commercial licenses are available from Glencoe Software.
https://www.openmicroscopy.org/bio-formats
GNU General Public License v2.0
370 stars 241 forks source link

Turn off file-leak-detector if tests are run with Java 21 #4159

Closed melissalinkert closed 3 months ago

melissalinkert commented 4 months ago

See discussion in #4158.

Not sure if there is a better way to do this (in particular, to exclude >= 21), but this should at least allow tests to run on Java 21 for now.

sbesson commented 3 months ago

Discussed earlier today with @dgault and @melissalinkert, the current proposal offers a good compromise allowing to run the non-regression repository tests on JDK 21 without dropping support for JDK 8 yet and still testing file leaks.
To facilitate debugging and identification of the JDK used in a test run, we might want to update FormatReaderTestFactory.createInstances to also print the Java version as an INFO level statement.

melissalinkert commented 3 months ago

Java version should now be logged each time tests are run.

As suggested by @dgault, fafc56b picks a different file-leak-detector version based on the JDK version being used. The Ant build changes have been reverted so that file-leak-detector remains enabled. That seems to work locally - I can now both compile and run tests on both 8 and 21. Assuming it also works in the next 4 nightly builds in which it's included, that was easier than I expected and worth considering in the context of https://github.com/ome/ome-common-java/pull/72.