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.module.ModuleDescriptor;
42 import java.lang.reflect.Executable;
43 import java.lang.reflect.Method;
44 import java.net.URI;
45 import java.nio.channels.Channel;
46 import java.nio.channels.spi.SelectorProvider;
47 import java.nio.charset.CharacterCodingException;
48 import java.nio.charset.Charset;
49 import java.security.ProtectionDomain;
50 import java.util.List;
51 import java.util.Locale;
52 import java.util.Map;
53 import java.util.Objects;
54 import java.util.Properties;
55 import java.util.ResourceBundle;
56 import java.util.Set;
57 import java.util.concurrent.Executor;
58 import java.util.function.Supplier;
59 import java.util.concurrent.ConcurrentHashMap;
60 import java.util.stream.Stream;
61
469 * @throws IndexOutOfBoundsException if copying would cause
470 * access of data outside array bounds.
471 * @throws ArrayStoreException if an element in the {@code src}
472 * array could not be stored into the {@code dest} array
473 * because of a type mismatch.
474 * @throws NullPointerException if either {@code src} or
475 * {@code dest} is {@code null}.
476 */
477 @IntrinsicCandidate
478 public static native void arraycopy(Object src, int srcPos,
479 Object dest, int destPos,
480 int length);
481
482 /**
483 * Returns the same hash code for the given object as
484 * would be returned by the default method hashCode(),
485 * whether or not the given object's class overrides
486 * hashCode().
487 * The hash code for the null reference is zero.
488 *
489 * @param x object for which the hashCode is to be calculated
490 * @return the hashCode
491 * @since 1.1
492 * @see Object#hashCode
493 * @see java.util.Objects#hashCode(Object)
494 */
495 @IntrinsicCandidate
496 public static native int identityHashCode(Object x);
497
498 /**
499 * System properties.
500 *
501 * See {@linkplain #getProperties getProperties} for details.
502 */
503 private static Properties props;
504
505 /**
506 * Determines the current system properties.
507 * <p>
508 * The current set of system properties for use by the
2300 }
2301
2302 public void unparkVirtualThread(Thread thread) {
2303 if (thread instanceof BaseVirtualThread vthread) {
2304 vthread.unpark();
2305 } else {
2306 throw new WrongThreadException();
2307 }
2308 }
2309
2310 public Executor virtualThreadDefaultScheduler() {
2311 return VirtualThread.defaultScheduler();
2312 }
2313
2314 public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2315 ContinuationScope contScope,
2316 Continuation continuation) {
2317 return StackWalker.newInstance(options, null, contScope, continuation);
2318 }
2319
2320 public String getLoaderNameID(ClassLoader loader) {
2321 return loader != null ? loader.nameAndId() : "null";
2322 }
2323
2324 @Override
2325 public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2326 string.copyToSegmentRaw(segment, offset);
2327 }
2328
2329 @Override
2330 public boolean bytesCompatible(String string, Charset charset) {
2331 return string.bytesCompatible(charset);
2332 }
2333 });
2334 }
2335 }
|
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.module.ModuleDescriptor;
42 import java.lang.reflect.ClassFileFormatVersion;
43 import java.lang.reflect.Executable;
44 import java.lang.reflect.Method;
45 import java.net.URI;
46 import java.nio.channels.Channel;
47 import java.nio.channels.spi.SelectorProvider;
48 import java.nio.charset.CharacterCodingException;
49 import java.nio.charset.Charset;
50 import java.security.ProtectionDomain;
51 import java.util.List;
52 import java.util.Locale;
53 import java.util.Map;
54 import java.util.Objects;
55 import java.util.Properties;
56 import java.util.ResourceBundle;
57 import java.util.Set;
58 import java.util.concurrent.Executor;
59 import java.util.function.Supplier;
60 import java.util.concurrent.ConcurrentHashMap;
61 import java.util.stream.Stream;
62
470 * @throws IndexOutOfBoundsException if copying would cause
471 * access of data outside array bounds.
472 * @throws ArrayStoreException if an element in the {@code src}
473 * array could not be stored into the {@code dest} array
474 * because of a type mismatch.
475 * @throws NullPointerException if either {@code src} or
476 * {@code dest} is {@code null}.
477 */
478 @IntrinsicCandidate
479 public static native void arraycopy(Object src, int srcPos,
480 Object dest, int destPos,
481 int length);
482
483 /**
484 * Returns the same hash code for the given object as
485 * would be returned by the default method hashCode(),
486 * whether or not the given object's class overrides
487 * hashCode().
488 * The hash code for the null reference is zero.
489 *
490 * <div class="preview-block">
491 * <div class="preview-comment">
492 * The "identity hash code" of a {@linkplain Class#isValue() value object}
493 * is computed by combining the identity hash codes of the value object's fields recursively.
494 * </div>
495 * </div>
496 * @apiNote
497 * <div class="preview-block">
498 * <div class="preview-comment">
499 * Note that, like ==, this hash code exposes information about a value object's
500 * private fields that might otherwise be hidden by an identity object.
501 * Developers should be cautious about storing sensitive secrets in value object fields.
502 * </div>
503 * </div>
504 *
505 * @param x object for which the hashCode is to be calculated
506 * @return the hashCode
507 * @since 1.1
508 * @see Object#hashCode
509 * @see java.util.Objects#hashCode(Object)
510 */
511 @IntrinsicCandidate
512 public static native int identityHashCode(Object x);
513
514 /**
515 * System properties.
516 *
517 * See {@linkplain #getProperties getProperties} for details.
518 */
519 private static Properties props;
520
521 /**
522 * Determines the current system properties.
523 * <p>
524 * The current set of system properties for use by the
2316 }
2317
2318 public void unparkVirtualThread(Thread thread) {
2319 if (thread instanceof BaseVirtualThread vthread) {
2320 vthread.unpark();
2321 } else {
2322 throw new WrongThreadException();
2323 }
2324 }
2325
2326 public Executor virtualThreadDefaultScheduler() {
2327 return VirtualThread.defaultScheduler();
2328 }
2329
2330 public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2331 ContinuationScope contScope,
2332 Continuation continuation) {
2333 return StackWalker.newInstance(options, null, contScope, continuation);
2334 }
2335
2336 public int classFileFormatVersion(Class<?> clazz) {
2337 return clazz.getClassFileVersion();
2338 }
2339
2340 public String getLoaderNameID(ClassLoader loader) {
2341 return loader != null ? loader.nameAndId() : "null";
2342 }
2343
2344 @Override
2345 public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2346 string.copyToSegmentRaw(segment, offset);
2347 }
2348
2349 @Override
2350 public boolean bytesCompatible(String string, Charset charset) {
2351 return string.bytesCompatible(charset);
2352 }
2353 });
2354 }
2355 }
|