xazap commented on PR #897:
URL: https://github.com/apache/commons-io/pull/897#issuecomment-6809280221
It turns out my previous assessment of needing an alternative the
sun.misc.Unsafe was because of the misleading stacktrace. I reverted the
`ByteBufferCleaner` to its previous state and only fixed the stacktrace by
setting `e1` (the Java 9 exception) instead of `e` (the Java 8 exception) as
its root cause.
The assumed `jdk.internal.ref.Cleaner` as an alternative was incorrect. I
believed it to be working because the existing `ByteBufferCleanerTest` passed,
but upon closer inspection the `ByteBufferCleanerTest` tests invocation of the
cleaner, but not if it actually cleaned anything.
The POM was changed to make the unit tests do two passes on Java 9+: one
with classes on the classpath and another one on the module path.
Not sure if POM changes should be kept: when testing on the module path it
needs some `--add-opens entries to ALL-UNNAMED` whereas the library final build
is actually named. The problem with keeping the library at Java 8 is that it
forces us to generates a module-info.java at package-time. It is therefore not
available when the unit tests run on Java 9+. The consideration should
therefore be if the module path test are useful without a module-info. A good
test setup would include module-info and would also have a module-info for the
test classes as well.
Anyway, I pushed my latest insights to the PR.
The stacktrace fix is worth merging I think as that provides the hints on
what `--add-opens entries` should be used when using commons-io on the module
path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]