Bug 552594 - Fix framework extensions with built-in Java 9 app loader

In Java 9 the application class loader changed from a URLClassLoader to
an internal type jdk.internal.loader.ClassLoaders.AppClassLoader.  The
new AppClassLoader no longer has the addURL method that we used to add
framework extension content to the class loader when the framework is
loaded from the java class path.

This fix uses the method appendToClassPathForInstrumentation(String) on
the new AppClassLoader class. To do this extra work is needed to allow
reflection on the AppClassLoader class.  This is not ideal, but will
allow the framework extensions to work when the framework is launched
from the java application class path.

Note that Eclipse launcher uses its own class loader which still has
addURL method available.  This new approach is only attempted if the
class loader used to launch the framework does not have an available
addURL method.

Change-Id: I0a4195307db6fb87dbab08933584e1a798ccf34a
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
2 files changed