< prev index next >

src/java.base/share/classes/java/lang/module/ModuleFinder.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs

@@ -37,10 +37,11 @@
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import sun.security.action.GetPropertyAction;
 
 /**
  * A finder of modules. A {@code ModuleFinder} is used to find modules during
  * <a href="Configuration.html#resolution">resolution</a> or
  * <a href="Configuration.html#servicebinding">service binding</a>.

@@ -150,11 +151,11 @@
     static ModuleFinder ofSystem() {
         String home;
 
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            PrivilegedAction<String> pa = () -> System.getProperty("java.home");
+            PrivilegedAction<String> pa = new GetPropertyAction("java.home");
             home = AccessController.doPrivileged(pa);
             Permission p = new FilePermission(home + File.separator + "-", "read");
             sm.checkPermission(p);
         } else {
             home = System.getProperty("java.home");
< prev index next >