I am developing an application that is using some internal JDK packages (sun.*) to work around some problems with "leaked" Swing objects that reference my application classloader via their protection domain. This means that my application classloader cannot be garbage collected even if I remove all references to it from within my application. This is a problem because my application uses native DLLs that sometimes need to be replaced by new versions without restarting the application and these DLLs cannot be unloaded and reloaded unless the application classloader that loaded these DLLs has been garbage collected.
The workarounds I am using for this problem use a combination of internal APIs together with reflection to locate the fields that are holding these internal "leaked" objects and set these fields to null. With JDK 9 and Project Jigsaw, I understand that it will no longer be possible for my application to directly reference internal sun.* classes. Will it still be possible to use ClassLoader.loadClass to load these sun.* classes and use reflection to invoke their methods? Simon Nash
