< prev index next >

src/java.base/share/classes/jdk/internal/module/SystemModuleFinders.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


  66 
  67 /**
  68  * The factory for SystemModules objects and for creating ModuleFinder objects
  69  * that find modules in the runtime image.
  70  *
  71  * This class supports initializing the module system when the runtime is an
  72  * images build, an exploded build, or an images build with java.base patched
  73  * by an exploded java.base. It also supports a testing mode that re-parses
  74  * the module-info.class resources in the run-time image.
  75  */
  76 
  77 public final class SystemModuleFinders {
  78     private static final JavaNetUriAccess JNUA = SharedSecrets.getJavaNetUriAccess();
  79 
  80     private static final boolean USE_FAST_PATH;
  81     static {
  82         String value = System.getProperty("jdk.system.module.finder.disableFastPath");
  83         if (value == null) {
  84             USE_FAST_PATH = true;
  85         } else {
  86             USE_FAST_PATH = (value.length() > 0) && !Boolean.parseBoolean(value);
  87         }
  88     }
  89 
  90     // cached ModuleFinder returned from ofSystem
  91     private static volatile ModuleFinder cachedSystemModuleFinder;
  92 
  93     private SystemModuleFinders() { }
  94 
  95     /**
  96      * Returns the SystemModules object to reconstitute all modules. Returns
  97      * null if this is an exploded build or java.base is patched by an exploded
  98      * build.
  99      */
 100     static SystemModules allSystemModules() {
 101         if (USE_FAST_PATH) {
 102             return SystemModulesMap.allSystemModules();
 103         } else {
 104             return null;
 105         }
 106     }




  66 
  67 /**
  68  * The factory for SystemModules objects and for creating ModuleFinder objects
  69  * that find modules in the runtime image.
  70  *
  71  * This class supports initializing the module system when the runtime is an
  72  * images build, an exploded build, or an images build with java.base patched
  73  * by an exploded java.base. It also supports a testing mode that re-parses
  74  * the module-info.class resources in the run-time image.
  75  */
  76 
  77 public final class SystemModuleFinders {
  78     private static final JavaNetUriAccess JNUA = SharedSecrets.getJavaNetUriAccess();
  79 
  80     private static final boolean USE_FAST_PATH;
  81     static {
  82         String value = System.getProperty("jdk.system.module.finder.disableFastPath");
  83         if (value == null) {
  84             USE_FAST_PATH = true;
  85         } else {
  86             USE_FAST_PATH = !value.isEmpty() && !Boolean.parseBoolean(value);
  87         }
  88     }
  89 
  90     // cached ModuleFinder returned from ofSystem
  91     private static volatile ModuleFinder cachedSystemModuleFinder;
  92 
  93     private SystemModuleFinders() { }
  94 
  95     /**
  96      * Returns the SystemModules object to reconstitute all modules. Returns
  97      * null if this is an exploded build or java.base is patched by an exploded
  98      * build.
  99      */
 100     static SystemModules allSystemModules() {
 101         if (USE_FAST_PATH) {
 102             return SystemModulesMap.allSystemModules();
 103         } else {
 104             return null;
 105         }
 106     }


< prev index next >