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.concurrent.ScheduledExecutorService;
59 import java.util.function.Supplier;
60 import java.util.concurrent.ConcurrentHashMap;
61 import java.util.stream.Stream;
461 * @throws IndexOutOfBoundsException if copying would cause
462 * access of data outside array bounds.
463 * @throws ArrayStoreException if an element in the {@code src}
464 * array could not be stored into the {@code dest} array
465 * because of a type mismatch.
466 * @throws NullPointerException if either {@code src} or
467 * {@code dest} is {@code null}.
468 */
469 @IntrinsicCandidate
470 public static native void arraycopy(Object src, int srcPos,
471 Object dest, int destPos,
472 int length);
473
474 /**
475 * Returns the same hash code for the given object as
476 * would be returned by the default method hashCode(),
477 * whether or not the given object's class overrides
478 * hashCode().
479 * The hash code for the null reference is zero.
480 *
481 * @param x object for which the hashCode is to be calculated
482 * @return the hashCode
483 * @since 1.1
484 * @see Object#hashCode
485 * @see java.util.Objects#hashCode(Object)
486 */
487 @IntrinsicCandidate
488 public static native int identityHashCode(Object x);
489
490 /**
491 * System properties.
492 *
493 * See {@linkplain #getProperties getProperties} for details.
494 */
495 private static Properties props;
496
497 /**
498 * Determines the current system properties.
499 * <p>
500 * The current set of system properties for use by the
2289 }
2290
2291 public void unparkVirtualThread(Thread thread) {
2292 if (thread instanceof BaseVirtualThread vthread) {
2293 vthread.unpark();
2294 } else {
2295 throw new WrongThreadException();
2296 }
2297 }
2298
2299 public Executor virtualThreadDefaultScheduler() {
2300 return VirtualThread.defaultScheduler();
2301 }
2302
2303 public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2304 ContinuationScope contScope,
2305 Continuation continuation) {
2306 return StackWalker.newInstance(options, null, contScope, continuation);
2307 }
2308
2309 public String getLoaderNameID(ClassLoader loader) {
2310 return loader != null ? loader.nameAndId() : "null";
2311 }
2312
2313 @Override
2314 public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2315 string.copyToSegmentRaw(segment, offset);
2316 }
2317
2318 @Override
2319 public boolean bytesCompatible(String string, Charset charset) {
2320 return string.bytesCompatible(charset);
2321 }
2322 });
2323 }
2324 }
|
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.concurrent.ScheduledExecutorService;
60 import java.util.function.Supplier;
61 import java.util.concurrent.ConcurrentHashMap;
62 import java.util.stream.Stream;
462 * @throws IndexOutOfBoundsException if copying would cause
463 * access of data outside array bounds.
464 * @throws ArrayStoreException if an element in the {@code src}
465 * array could not be stored into the {@code dest} array
466 * because of a type mismatch.
467 * @throws NullPointerException if either {@code src} or
468 * {@code dest} is {@code null}.
469 */
470 @IntrinsicCandidate
471 public static native void arraycopy(Object src, int srcPos,
472 Object dest, int destPos,
473 int length);
474
475 /**
476 * Returns the same hash code for the given object as
477 * would be returned by the default method hashCode(),
478 * whether or not the given object's class overrides
479 * hashCode().
480 * The hash code for the null reference is zero.
481 *
482 * <div class="preview-block">
483 * <div class="preview-comment">
484 * The "identity hash code" of a {@linkplain Class#isValue() value object}
485 * is computed by combining the identity hash codes of the value object's fields recursively.
486 * </div>
487 * </div>
488 * @apiNote
489 * <div class="preview-block">
490 * <div class="preview-comment">
491 * Note that, like ==, this hash code exposes information about a value object's
492 * private fields that might otherwise be hidden by an identity object.
493 * Developers should be cautious about storing sensitive secrets in value object fields.
494 * </div>
495 * </div>
496 *
497 * @param x object for which the hashCode is to be calculated
498 * @return the hashCode
499 * @since 1.1
500 * @see Object#hashCode
501 * @see java.util.Objects#hashCode(Object)
502 */
503 @IntrinsicCandidate
504 public static native int identityHashCode(Object x);
505
506 /**
507 * System properties.
508 *
509 * See {@linkplain #getProperties getProperties} for details.
510 */
511 private static Properties props;
512
513 /**
514 * Determines the current system properties.
515 * <p>
516 * The current set of system properties for use by the
2305 }
2306
2307 public void unparkVirtualThread(Thread thread) {
2308 if (thread instanceof BaseVirtualThread vthread) {
2309 vthread.unpark();
2310 } else {
2311 throw new WrongThreadException();
2312 }
2313 }
2314
2315 public Executor virtualThreadDefaultScheduler() {
2316 return VirtualThread.defaultScheduler();
2317 }
2318
2319 public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2320 ContinuationScope contScope,
2321 Continuation continuation) {
2322 return StackWalker.newInstance(options, null, contScope, continuation);
2323 }
2324
2325 public int classFileFormatVersion(Class<?> clazz) {
2326 return clazz.getClassFileVersion();
2327 }
2328
2329 public String getLoaderNameID(ClassLoader loader) {
2330 return loader != null ? loader.nameAndId() : "null";
2331 }
2332
2333 @Override
2334 public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2335 string.copyToSegmentRaw(segment, offset);
2336 }
2337
2338 @Override
2339 public boolean bytesCompatible(String string, Charset charset) {
2340 return string.bytesCompatible(charset);
2341 }
2342 });
2343 }
2344 }
|