Since the Maven library features in helper are deemed broken on Java 16+, this PR adapts and utilizes SlimJar's UnsafeInjectable to inject URLs into URLClassLoaders using sun.misc.Unsafe. This solution works well on Java 9+ and can be used to get the API to work again.
Since the Maven library features in helper are deemed broken on Java 16+, this PR adapts and utilizes SlimJar's UnsafeInjectable to inject URLs into URLClassLoaders using sun.misc.Unsafe. This solution works well on Java 9+ and can be used to get the API to work again.
Side implementation note: UnsafeURLInjector only works on Java 9+. While it is possible to make it work for Java 8 by replacing ArrayDeque with a generic Collection, and use
urls
as the field name for Java 8, I believe this is unnecessary since you can directly use reflections to add URLs on that version.