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