Unsafe.invokeCleaner warning with Java 25
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 844
- Avg merge
- 5h 52m
- Merged PRs (30d)
- 47
Description
Unsafe.invokeCleaner usage in CleanerUtil triggers a warning with Java 25:
```
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::invokeCleaner has been called by org.apache.poi.poifs.nio.CleanerUtil (file:~/.m2/repository/org/apache/poi/poi/5.5.1/poi-5.5.1.jar)
WARNING: Please consider reporting this to the maintainers of class org.apache.poi.poifs.nio.CleanerUtil
WARNING: sun.misc.Unsafe::invokeCleaner will be removed in a future release
```
The code in CleanerUtil comes from [Hadoop](https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/CleanerUtil.java) and Lucene. Hadoop still uses the same version but Lucene upgraded it in 2022 (https://github.com/apache/lucene/pull/912, https://github.com/apache/lucene/commit/3b9c728ab558255eb8329a017b9d235611d7b142) to use the Foreign Function & Memory API (JEP 454).
Would it be possible to update CleanerUtil to also use the FFM API on Java 22 and later?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with CleanerUtil and compare its current Unsafe.invokeCleaner implementation with the linked Hadoop and Lucene versions that use the Foreign Function & Memory API. Reproduce the warning on Java 25, then verify that the updated cleanup path works on Java 22 and later without breaking supported older Java versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100