HebiRobotics/MFL

Get rid of usage of legacy sun.misc.Unsafe API

Closed this issue · 1 comments

MFL still drags some legacy dependency on non-public/unsafe/unsupported sun.misc.Unsafe API, which has been deprecated/discouraged for a while.

Part of sun.misc.Unsafe was moved to java.lang.ref in Java 9, among others java.lang.ref.Cleaner. Sounds to me like a good alternative.

Any chance of fixing this in the near future? Then we would consider the step and move from jmatio to MFL (Because jmatio has the same issue, but from what I read is in maintenance only stage)

No, because there is no "fix".

One of the issues is that we can't use Java 9+ APIs without one of
(a) Switching to Java 9+ and breaking compatibility with earlier versions
(b) Using a multi-release jar that is a huge pain to create and still breaks many build tools

Even if we could use Java 9, we would still have to use Unsafe::invokeCleaner (which is actually a new API), so there is currently no supported way to get rid of all of the deprecation warnings.

MFL currently runs on everything from JDK6 through JDK14, and we will continue to support new versions. If there are ever viable supported alternatives we will switch to those, but for now you shouldn't worry about it.