Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java @ 23380:cd8fd4cced6c
added JVMCIPermission (JDK-8155023)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 09 May 2016 16:34:20 +0200 |
parents | 5aa3b3a72e35 |
children | f84a5ac3be22 |
comparison
equal
deleted
inserted
replaced
23379:24505bf61633 | 23380:cd8fd4cced6c |
---|---|
73 * Note: This API exists to provide backwards compatibility for JVMCI clients compiled against a | 73 * Note: This API exists to provide backwards compatibility for JVMCI clients compiled against a |
74 * JDK release earlier than 9. | 74 * JDK release earlier than 9. |
75 * | 75 * |
76 * @param requestor a class requesting access to the JVMCI module for its module | 76 * @param requestor a class requesting access to the JVMCI module for its module |
77 * @throws SecurityException if a security manager is present and it denies | 77 * @throws SecurityException if a security manager is present and it denies |
78 * {@code RuntimePermission("jvmci")} | 78 * {@link JVMCIPermission} |
79 */ | 79 */ |
80 public static void exportJVMCITo(Class<?> requestor) { | 80 public static void exportJVMCITo(Class<?> requestor) { |
81 // There are no modules in JVMCI-8. | 81 // There are no modules in JVMCI-8. |
82 } | 82 } |
83 | 83 |
89 */ | 89 */ |
90 @SuppressWarnings("unchecked") | 90 @SuppressWarnings("unchecked") |
91 public static <S> Iterable<S> load(Class<S> service) { | 91 public static <S> Iterable<S> load(Class<S> service) { |
92 SecurityManager sm = System.getSecurityManager(); | 92 SecurityManager sm = System.getSecurityManager(); |
93 if (sm != null) { | 93 if (sm != null) { |
94 sm.checkPermission(new RuntimePermission("jvmci")); | 94 sm.checkPermission(new JVMCIPermission()); |
95 } | 95 } |
96 try { | 96 try { |
97 return (Iterable<S>) cache.get(service); | 97 return (Iterable<S>) cache.get(service); |
98 } catch (UnsatisfiedLinkError e) { | 98 } catch (UnsatisfiedLinkError e) { |
99 return Collections.emptyList(); | 99 return Collections.emptyList(); |
111 */ | 111 */ |
112 @SuppressWarnings({"unchecked"}) | 112 @SuppressWarnings({"unchecked"}) |
113 public static <S> S loadSingle(Class<S> service, boolean required) { | 113 public static <S> S loadSingle(Class<S> service, boolean required) { |
114 SecurityManager sm = System.getSecurityManager(); | 114 SecurityManager sm = System.getSecurityManager(); |
115 if (sm != null) { | 115 if (sm != null) { |
116 sm.checkPermission(new RuntimePermission("jvmci")); | 116 sm.checkPermission(new JVMCIPermission()); |
117 } | 117 } |
118 Iterable<S> providers; | 118 Iterable<S> providers; |
119 try { | 119 try { |
120 providers = (Iterable<S>) cache.get(service); | 120 providers = (Iterable<S>) cache.get(service); |
121 } catch (UnsatisfiedLinkError e) { | 121 } catch (UnsatisfiedLinkError e) { |