10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.internal.access;
27
28 import java.io.InputStream;
29 import java.lang.annotation.Annotation;
30 import java.lang.invoke.MethodHandle;
31 import java.lang.invoke.MethodType;
32 import java.lang.module.ModuleDescriptor;
33 import java.lang.reflect.Executable;
34 import java.lang.reflect.Method;
35 import java.net.URI;
36 import java.nio.charset.CharacterCodingException;
37 import java.nio.charset.Charset;
38 import java.security.AccessControlContext;
39 import java.security.ProtectionDomain;
40 import java.util.List;
41 import java.util.Map;
42 import java.util.Set;
43 import java.util.concurrent.Callable;
44 import java.util.concurrent.ConcurrentHashMap;
45 import java.util.concurrent.RejectedExecutionException;
46 import java.util.stream.Stream;
47
48 import jdk.internal.javac.PreviewFeature;
49 import jdk.internal.misc.CarrierThreadLocal;
256
257 /**
258 * Returns true if module m reflectively opens a package to other
259 */
260 boolean isReflectivelyOpened(Module module, String pn, Module other);
261
262 /**
263 * Updates module m to allow access to restricted methods.
264 */
265 Module addEnableNativeAccess(Module m);
266
267 /**
268 * Updates all unnamed modules to allow access to restricted methods.
269 */
270 void addEnableNativeAccessToAllUnnamed();
271
272 /**
273 * Ensure that the given module has native access. If not, warn or
274 * throw exception depending on the configuration.
275 */
276 void ensureNativeAccess(Module m, Class<?> owner, String methodName);
277
278 /**
279 * Returns the ServicesCatalog for the given Layer.
280 */
281 ServicesCatalog getServicesCatalog(ModuleLayer layer);
282
283 /**
284 * Record that this layer has at least one module defined to the given
285 * class loader.
286 */
287 void bindToLoader(ModuleLayer layer, ClassLoader loader);
288
289 /**
290 * Returns an ordered stream of layers. The first element is the
291 * given layer, the remaining elements are its parents, in DFS order.
292 */
293 Stream<ModuleLayer> layers(ModuleLayer layer);
294
295 /**
296 * Returns a stream of the layers that have modules defined to the
557 /**
558 * Re-enables a virtual thread for scheduling. If the thread was parked then
559 * it will be unblocked, otherwise its next attempt to park will not block
560 * @param thread the virtual thread to unpark
561 * @throws IllegalArgumentException if the thread is not a virtual thread
562 * @throws RejectedExecutionException if the scheduler cannot accept a task
563 */
564 void unparkVirtualThread(Thread thread);
565
566 /**
567 * Creates a new StackWalker
568 */
569 StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
570 ContinuationScope contScope,
571 Continuation continuation);
572 /**
573 * Returns '<loader-name>' @<id> if classloader has a name
574 * explicitly set otherwise <qualified-class-name> @<id>
575 */
576 String getLoaderNameID(ClassLoader loader);
577 }
|
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.internal.access;
27
28 import java.io.InputStream;
29 import java.lang.annotation.Annotation;
30 import java.lang.foreign.MemorySegment;
31 import java.lang.invoke.MethodHandle;
32 import java.lang.invoke.MethodType;
33 import java.lang.module.ModuleDescriptor;
34 import java.lang.reflect.Executable;
35 import java.lang.reflect.Method;
36 import java.net.URI;
37 import java.nio.charset.CharacterCodingException;
38 import java.nio.charset.Charset;
39 import java.security.AccessControlContext;
40 import java.security.ProtectionDomain;
41 import java.util.List;
42 import java.util.Map;
43 import java.util.Set;
44 import java.util.concurrent.Callable;
45 import java.util.concurrent.ConcurrentHashMap;
46 import java.util.concurrent.RejectedExecutionException;
47 import java.util.stream.Stream;
48
49 import jdk.internal.javac.PreviewFeature;
50 import jdk.internal.misc.CarrierThreadLocal;
257
258 /**
259 * Returns true if module m reflectively opens a package to other
260 */
261 boolean isReflectivelyOpened(Module module, String pn, Module other);
262
263 /**
264 * Updates module m to allow access to restricted methods.
265 */
266 Module addEnableNativeAccess(Module m);
267
268 /**
269 * Updates all unnamed modules to allow access to restricted methods.
270 */
271 void addEnableNativeAccessToAllUnnamed();
272
273 /**
274 * Ensure that the given module has native access. If not, warn or
275 * throw exception depending on the configuration.
276 */
277 void ensureNativeAccess(Module m, Class<?> owner, String methodName, Class<?> currentClass);
278
279 /**
280 * Returns the ServicesCatalog for the given Layer.
281 */
282 ServicesCatalog getServicesCatalog(ModuleLayer layer);
283
284 /**
285 * Record that this layer has at least one module defined to the given
286 * class loader.
287 */
288 void bindToLoader(ModuleLayer layer, ClassLoader loader);
289
290 /**
291 * Returns an ordered stream of layers. The first element is the
292 * given layer, the remaining elements are its parents, in DFS order.
293 */
294 Stream<ModuleLayer> layers(ModuleLayer layer);
295
296 /**
297 * Returns a stream of the layers that have modules defined to the
558 /**
559 * Re-enables a virtual thread for scheduling. If the thread was parked then
560 * it will be unblocked, otherwise its next attempt to park will not block
561 * @param thread the virtual thread to unpark
562 * @throws IllegalArgumentException if the thread is not a virtual thread
563 * @throws RejectedExecutionException if the scheduler cannot accept a task
564 */
565 void unparkVirtualThread(Thread thread);
566
567 /**
568 * Creates a new StackWalker
569 */
570 StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
571 ContinuationScope contScope,
572 Continuation continuation);
573 /**
574 * Returns '<loader-name>' @<id> if classloader has a name
575 * explicitly set otherwise <qualified-class-name> @<id>
576 */
577 String getLoaderNameID(ClassLoader loader);
578
579 /**
580 * Copy the string bytes to an existing segment, avoiding intermediate copies.
581 */
582 void copyToSegmentRaw(String string, MemorySegment segment, long offset);
583
584 /**
585 * Are the string bytes compatible with the given charset?
586 */
587 boolean bytesCompatible(String string, Charset charset);
588 }
|