private List < ClasspathElementModule > getModuleOrder ( final LogNode log ) throws InterruptedException { final List < ClasspathElementModule > moduleCpEltOrder = new ArrayList <> ( ) ; if ( scanSpec . overrideClasspath == null && scanSpec . overrideClassLoaders == null && scanSpec . scanModules ) { // Add modules to start of classpath order, before traditional classpath final List < ModuleRef > systemModuleRefs = classLoaderAndModuleFinder . getSystemModuleRefs ( ) ; final ClassLoader defaultClassLoader = classLoaderOrderRespectingParentDelegation != null && classLoaderOrderRespectingParentDelegation . length != 0 ? classLoaderOrderRespectingParentDelegation [ 0 ] : null ; if ( systemModuleRefs != null ) { for ( final ModuleRef systemModuleRef : systemModuleRefs ) { final String moduleName = systemModuleRef . getName ( ) ; if ( // If scanning system packages and modules is enabled and white/blacklist is empty, // then scan all system modules ( scanSpec . enableSystemJarsAndModules && scanSpec . moduleWhiteBlackList . whitelistAndBlacklistAreEmpty ( ) ) // Otherwise only scan specifically whitelisted system modules || scanSpec . moduleWhiteBlackList . isSpecificallyWhitelistedAndNotBlacklisted ( moduleName ) ) { // Create a new ClasspathElementModule final ClasspathElementModule classpathElementModule = new ClasspathElementModule ( systemModuleRef , defaultClassLoader , nestedJarHandler , scanSpec ) ; moduleCpEltOrder . add ( classpathElementModule ) ; // Open the ClasspathElementModule classpathElementModule . open ( /* ignored */ null , log ) ; } else { if ( log != null ) { log . log ( "Skipping non-whitelisted or blacklisted system module: " + moduleName ) ; } } } } final List < ModuleRef > nonSystemModuleRefs = classLoaderAndModuleFinder . getNonSystemModuleRefs ( ) ; if ( nonSystemModuleRefs != null ) { for ( final ModuleRef nonSystemModuleRef : nonSystemModuleRefs ) { String moduleName = nonSystemModuleRef . getName ( ) ; if ( moduleName == null ) { moduleName = "" ; } if ( scanSpec . moduleWhiteBlackList . isWhitelistedAndNotBlacklisted ( moduleName ) ) { // Create a new ClasspathElementModule final ClasspathElementModule classpathElementModule = new ClasspathElementModule ( nonSystemModuleRef , defaultClassLoader , nestedJarHandler , scanSpec ) ; moduleCpEltOrder . add ( classpathElementModule ) ; // Open the ClasspathElementModule classpathElementModule . open ( /* ignored */ null , log ) ; } else { if ( log != null ) { log . log ( "Skipping non-whitelisted or blacklisted module: " + moduleName ) ; } } } } } return moduleCpEltOrder ; }
Get the module order .