private void exportInternalAPI ( ClassLoader cl ) { String [ ] packages = { "com.sun.tools.doclets" , "com.sun.tools.doclets.standard" , "com.sun.tools.doclets.internal.toolkit" , "com.sun.tools.doclets.internal.toolkit.taglets" , "com.sun.tools.doclets.internal.toolkit.builders" , "com.sun.tools.doclets.internal.toolkit.util" , "com.sun.tools.doclets.internal.toolkit.util.links" , "com.sun.tools.doclets.formats.html" , "com.sun.tools.doclets.formats.html.markup" } ; try { Method getModuleMethod = Class . class . getDeclaredMethod ( "getModule" ) ; Object thisModule = getModuleMethod . invoke ( getClass ( ) ) ; Class < ? > moduleClass = Class . forName ( "java.lang.Module" ) ; Method addExportsMethod = moduleClass . getDeclaredMethod ( "addExports" , String . class , moduleClass ) ; Method getUnnamedModuleMethod = ClassLoader . class . getDeclaredMethod ( "getUnnamedModule" ) ; Object target = getUnnamedModuleMethod . invoke ( cl ) ; for ( String pack : packages ) { addExportsMethod . invoke ( thisModule , pack , target ) ; } } catch ( Exception e ) { // do nothing } }
Export javadoc internal API to the unnamed module for a classloader . This is to support continued use of existing non - standard doclets that use the internal toolkit API and related classes .