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 package java.lang;
26
27 import java.io.BufferedInputStream;
28 import java.io.BufferedOutputStream;
29 import java.io.Console;
30 import java.io.FileDescriptor;
31 import java.io.FileInputStream;
32 import java.io.FileOutputStream;
33 import java.io.IOException;
34 import java.io.InputStream;
35 import java.io.OutputStream;
36 import java.io.PrintStream;
37 import java.lang.annotation.Annotation;
38 import java.lang.invoke.MethodHandle;
39 import java.lang.invoke.MethodType;
40 import java.lang.invoke.StringConcatFactory;
41 import java.lang.module.ModuleDescriptor;
42 import java.lang.reflect.Constructor;
43 import java.lang.reflect.Executable;
44 import java.lang.reflect.Method;
45 import java.lang.reflect.Modifier;
46 import java.net.URI;
47 import java.net.URL;
48 import java.nio.channels.Channel;
49 import java.nio.channels.spi.SelectorProvider;
50 import java.nio.charset.CharacterCodingException;
51 import java.nio.charset.Charset;
52 import java.security.AccessControlContext;
53 import java.security.AccessController;
54 import java.security.CodeSource;
55 import java.security.PrivilegedAction;
56 import java.security.ProtectionDomain;
57 import java.util.Collections;
71 import jdk.internal.logger.LoggerFinderLoader.TemporaryLoggerFinder;
72 import jdk.internal.misc.CarrierThreadLocal;
73 import jdk.internal.misc.Unsafe;
74 import jdk.internal.util.StaticProperty;
75 import jdk.internal.module.ModuleBootstrap;
76 import jdk.internal.module.ServicesCatalog;
77 import jdk.internal.reflect.CallerSensitive;
78 import jdk.internal.reflect.Reflection;
79 import jdk.internal.access.JavaLangAccess;
80 import jdk.internal.access.SharedSecrets;
81 import jdk.internal.javac.PreviewFeature;
82 import jdk.internal.logger.LoggerFinderLoader;
83 import jdk.internal.logger.LazyLoggers;
84 import jdk.internal.logger.LocalizedLoggerWrapper;
85 import jdk.internal.misc.VM;
86 import jdk.internal.util.SystemProps;
87 import jdk.internal.vm.Continuation;
88 import jdk.internal.vm.ContinuationScope;
89 import jdk.internal.vm.StackableScope;
90 import jdk.internal.vm.ThreadContainer;
91 import jdk.internal.vm.annotation.ForceInline;
92 import jdk.internal.vm.annotation.IntrinsicCandidate;
93 import jdk.internal.vm.annotation.Stable;
94 import sun.nio.fs.DefaultFileSystemProvider;
95 import sun.reflect.annotation.AnnotationType;
96 import sun.nio.ch.Interruptible;
97 import sun.nio.cs.UTF_8;
98 import sun.security.util.SecurityConstants;
99
100 /**
101 * The {@code System} class contains several useful class fields
102 * and methods. It cannot be instantiated.
103 *
104 * Among the facilities provided by the {@code System} class
105 * are standard input, standard output, and error output streams;
106 * access to externally defined properties and environment
107 * variables; a means of loading files and libraries; and a utility
108 * method for quickly copying a portion of an array.
109 *
110 * @since 1.0
111 */
2437 m.implAddOpensToAllUnnamed(pn);
2438 }
2439 public void addOpensToAllUnnamed(Module m, Set<String> concealedPackages, Set<String> exportedPackages) {
2440 m.implAddOpensToAllUnnamed(concealedPackages, exportedPackages);
2441 }
2442 public void addUses(Module m, Class<?> service) {
2443 m.implAddUses(service);
2444 }
2445 public boolean isReflectivelyExported(Module m, String pn, Module other) {
2446 return m.isReflectivelyExported(pn, other);
2447 }
2448 public boolean isReflectivelyOpened(Module m, String pn, Module other) {
2449 return m.isReflectivelyOpened(pn, other);
2450 }
2451 public Module addEnableNativeAccess(Module m) {
2452 return m.implAddEnableNativeAccess();
2453 }
2454 public void addEnableNativeAccessToAllUnnamed() {
2455 Module.implAddEnableNativeAccessToAllUnnamed();
2456 }
2457 public void ensureNativeAccess(Module m, Class<?> owner, String methodName) {
2458 m.ensureNativeAccess(owner, methodName);
2459 }
2460 public ServicesCatalog getServicesCatalog(ModuleLayer layer) {
2461 return layer.getServicesCatalog();
2462 }
2463 public void bindToLoader(ModuleLayer layer, ClassLoader loader) {
2464 layer.bindToLoader(loader);
2465 }
2466 public Stream<ModuleLayer> layers(ModuleLayer layer) {
2467 return layer.layers();
2468 }
2469 public Stream<ModuleLayer> layers(ClassLoader loader) {
2470 return ModuleLayer.layers(loader);
2471 }
2472
2473 public int countPositives(byte[] bytes, int offset, int length) {
2474 return StringCoding.countPositives(bytes, offset, length);
2475 }
2476 public String newStringNoRepl(byte[] bytes, Charset cs) throws CharacterCodingException {
2477 return String.newStringNoRepl(bytes, cs);
2478 }
2652 }
2653 }
2654
2655 public void unparkVirtualThread(Thread thread) {
2656 if (thread instanceof BaseVirtualThread vthread) {
2657 vthread.unpark();
2658 } else {
2659 throw new WrongThreadException();
2660 }
2661 }
2662
2663 public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2664 ContinuationScope contScope,
2665 Continuation continuation) {
2666 return StackWalker.newInstance(options, null, contScope, continuation);
2667 }
2668
2669 public String getLoaderNameID(ClassLoader loader) {
2670 return loader.nameAndId();
2671 }
2672 });
2673 }
2674 }
|
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 package java.lang;
26
27 import java.io.BufferedInputStream;
28 import java.io.BufferedOutputStream;
29 import java.io.Console;
30 import java.io.FileDescriptor;
31 import java.io.FileInputStream;
32 import java.io.FileOutputStream;
33 import java.io.IOException;
34 import java.io.InputStream;
35 import java.io.OutputStream;
36 import java.io.PrintStream;
37 import java.lang.annotation.Annotation;
38 import java.lang.foreign.MemorySegment;
39 import java.lang.invoke.MethodHandle;
40 import java.lang.invoke.MethodType;
41 import java.lang.invoke.StringConcatFactory;
42 import java.lang.module.ModuleDescriptor;
43 import java.lang.reflect.Constructor;
44 import java.lang.reflect.Executable;
45 import java.lang.reflect.Method;
46 import java.lang.reflect.Modifier;
47 import java.net.URI;
48 import java.net.URL;
49 import java.nio.channels.Channel;
50 import java.nio.channels.spi.SelectorProvider;
51 import java.nio.charset.CharacterCodingException;
52 import java.nio.charset.Charset;
53 import java.security.AccessControlContext;
54 import java.security.AccessController;
55 import java.security.CodeSource;
56 import java.security.PrivilegedAction;
57 import java.security.ProtectionDomain;
58 import java.util.Collections;
72 import jdk.internal.logger.LoggerFinderLoader.TemporaryLoggerFinder;
73 import jdk.internal.misc.CarrierThreadLocal;
74 import jdk.internal.misc.Unsafe;
75 import jdk.internal.util.StaticProperty;
76 import jdk.internal.module.ModuleBootstrap;
77 import jdk.internal.module.ServicesCatalog;
78 import jdk.internal.reflect.CallerSensitive;
79 import jdk.internal.reflect.Reflection;
80 import jdk.internal.access.JavaLangAccess;
81 import jdk.internal.access.SharedSecrets;
82 import jdk.internal.javac.PreviewFeature;
83 import jdk.internal.logger.LoggerFinderLoader;
84 import jdk.internal.logger.LazyLoggers;
85 import jdk.internal.logger.LocalizedLoggerWrapper;
86 import jdk.internal.misc.VM;
87 import jdk.internal.util.SystemProps;
88 import jdk.internal.vm.Continuation;
89 import jdk.internal.vm.ContinuationScope;
90 import jdk.internal.vm.StackableScope;
91 import jdk.internal.vm.ThreadContainer;
92 import jdk.internal.vm.annotation.IntrinsicCandidate;
93 import jdk.internal.vm.annotation.Stable;
94 import sun.nio.fs.DefaultFileSystemProvider;
95 import sun.reflect.annotation.AnnotationType;
96 import sun.nio.ch.Interruptible;
97 import sun.nio.cs.UTF_8;
98 import sun.security.util.SecurityConstants;
99
100 /**
101 * The {@code System} class contains several useful class fields
102 * and methods. It cannot be instantiated.
103 *
104 * Among the facilities provided by the {@code System} class
105 * are standard input, standard output, and error output streams;
106 * access to externally defined properties and environment
107 * variables; a means of loading files and libraries; and a utility
108 * method for quickly copying a portion of an array.
109 *
110 * @since 1.0
111 */
2437 m.implAddOpensToAllUnnamed(pn);
2438 }
2439 public void addOpensToAllUnnamed(Module m, Set<String> concealedPackages, Set<String> exportedPackages) {
2440 m.implAddOpensToAllUnnamed(concealedPackages, exportedPackages);
2441 }
2442 public void addUses(Module m, Class<?> service) {
2443 m.implAddUses(service);
2444 }
2445 public boolean isReflectivelyExported(Module m, String pn, Module other) {
2446 return m.isReflectivelyExported(pn, other);
2447 }
2448 public boolean isReflectivelyOpened(Module m, String pn, Module other) {
2449 return m.isReflectivelyOpened(pn, other);
2450 }
2451 public Module addEnableNativeAccess(Module m) {
2452 return m.implAddEnableNativeAccess();
2453 }
2454 public void addEnableNativeAccessToAllUnnamed() {
2455 Module.implAddEnableNativeAccessToAllUnnamed();
2456 }
2457 public void ensureNativeAccess(Module m, Class<?> owner, String methodName, Class<?> currentClass) {
2458 m.ensureNativeAccess(owner, methodName, currentClass);
2459 }
2460 public ServicesCatalog getServicesCatalog(ModuleLayer layer) {
2461 return layer.getServicesCatalog();
2462 }
2463 public void bindToLoader(ModuleLayer layer, ClassLoader loader) {
2464 layer.bindToLoader(loader);
2465 }
2466 public Stream<ModuleLayer> layers(ModuleLayer layer) {
2467 return layer.layers();
2468 }
2469 public Stream<ModuleLayer> layers(ClassLoader loader) {
2470 return ModuleLayer.layers(loader);
2471 }
2472
2473 public int countPositives(byte[] bytes, int offset, int length) {
2474 return StringCoding.countPositives(bytes, offset, length);
2475 }
2476 public String newStringNoRepl(byte[] bytes, Charset cs) throws CharacterCodingException {
2477 return String.newStringNoRepl(bytes, cs);
2478 }
2652 }
2653 }
2654
2655 public void unparkVirtualThread(Thread thread) {
2656 if (thread instanceof BaseVirtualThread vthread) {
2657 vthread.unpark();
2658 } else {
2659 throw new WrongThreadException();
2660 }
2661 }
2662
2663 public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2664 ContinuationScope contScope,
2665 Continuation continuation) {
2666 return StackWalker.newInstance(options, null, contScope, continuation);
2667 }
2668
2669 public String getLoaderNameID(ClassLoader loader) {
2670 return loader.nameAndId();
2671 }
2672
2673 @Override
2674 public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2675 string.copyToSegmentRaw(segment, offset);
2676 }
2677
2678 @Override
2679 public boolean bytesCompatible(String string, Charset charset) {
2680 return string.bytesCompatible(charset);
2681 }
2682 });
2683 }
2684 }
|