< prev index next >

src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java

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

@@ -57,22 +57,22 @@
     // Creates the built-in class loaders.
     static {
         // -Xbootclasspath/a or -javaagent with Boot-Class-Path attribute
         String append = VM.getSavedProperty("jdk.boot.class.path.append");
         BOOT_LOADER =
-            new BootClassLoader((append != null && append.length() > 0)
+            new BootClassLoader((append != null && !append.isEmpty())
                 ? new URLClassPath(append, true)
                 : null);
         PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
 
         // A class path is required when no initial module is specified.
         // In this case the class path defaults to "", meaning the current
         // working directory.  When an initial module is specified, on the
         // contrary, we drop this historic interpretation of the empty
         // string and instead treat it as unspecified.
         String cp = System.getProperty("java.class.path");
-        if (cp == null || cp.length() == 0) {
+        if (cp == null || cp.isEmpty()) {
             String initialModuleName = System.getProperty("jdk.module.main");
             cp = (initialModuleName == null) ? "" : null;
         }
         URLClassPath ucp = new URLClassPath(cp, false);
         APP_LOADER = new AppClassLoader(PLATFORM_LOADER, ucp);
< prev index next >