1900 public static void gc() {
1901 Runtime.getRuntime().gc();
1902 }
1903
1904 /**
1905 * Runs the finalization methods of any objects pending finalization.
1906 *
1907 * Calling this method suggests that the Java Virtual Machine expend
1908 * effort toward running the {@code finalize} methods of objects
1909 * that have been found to be discarded but whose {@code finalize}
1910 * methods have not yet been run. When control returns from the
1911 * method call, the Java Virtual Machine has made a best effort to
1912 * complete all outstanding finalizations.
1913 * <p>
1914 * The call {@code System.runFinalization()} is effectively
1915 * equivalent to the call:
1916 * <blockquote><pre>
1917 * Runtime.getRuntime().runFinalization()
1918 * </pre></blockquote>
1919 *
1920 * @see java.lang.Runtime#runFinalization()
1921 */
1922 public static void runFinalization() {
1923 Runtime.getRuntime().runFinalization();
1924 }
1925
1926 /**
1927 * Loads the native library specified by the filename argument. The filename
1928 * argument must be an absolute path name.
1929 *
1930 * If the filename argument, when stripped of any platform-specific library
1931 * prefix, path, and file extension, indicates a library whose name is,
1932 * for example, L, and a native library called L is statically linked
1933 * with the VM, then the JNI_OnLoad_L function exported by the library
1934 * is invoked rather than attempting to load a dynamic library.
1935 * A filename matching the argument does not have to exist in the
1936 * file system.
1937 * See the <a href="{@docRoot}/../specs/jni/index.html"> JNI Specification</a>
1938 * for more details.
1939 *
1940 * Otherwise, the filename argument is mapped to a native library image in
1941 * an implementation-dependent manner.
2286 }
2287 public byte[] getRawClassTypeAnnotations(Class<?> klass) {
2288 return klass.getRawTypeAnnotations();
2289 }
2290 public byte[] getRawExecutableTypeAnnotations(Executable executable) {
2291 return Class.getExecutableTypeAnnotationBytes(executable);
2292 }
2293 public <E extends Enum<E>>
2294 E[] getEnumConstantsShared(Class<E> klass) {
2295 return klass.getEnumConstantsShared();
2296 }
2297 public void blockedOn(Interruptible b) {
2298 Thread.blockedOn(b);
2299 }
2300 public void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook) {
2301 Shutdown.add(slot, registerShutdownInProgress, hook);
2302 }
2303 public Thread newThreadWithAcc(Runnable target, @SuppressWarnings("removal") AccessControlContext acc) {
2304 return new Thread(target, acc);
2305 }
2306 @SuppressWarnings("deprecation")
2307 public void invokeFinalize(Object o) throws Throwable {
2308 o.finalize();
2309 }
2310 public ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl) {
2311 return cl.createOrGetClassLoaderValueMap();
2312 }
2313 public Class<?> defineClass(ClassLoader loader, String name, byte[] b, ProtectionDomain pd, String source) {
2314 return ClassLoader.defineClass1(loader, name, b, 0, b.length, pd, source);
2315 }
2316 public Class<?> defineClass(ClassLoader loader, Class<?> lookup, String name, byte[] b, ProtectionDomain pd,
2317 boolean initialize, int flags, Object classData) {
2318 return ClassLoader.defineClass0(loader, lookup, name, b, 0, b.length, pd, initialize, flags, classData);
2319 }
2320 public Class<?> findBootstrapClassOrNull(String name) {
2321 return ClassLoader.findBootstrapClassOrNull(name);
2322 }
2323 public Package definePackage(ClassLoader cl, String name, Module module) {
2324 return cl.definePackage(name, module);
2325 }
2326 public String fastUUID(long lsb, long msb) {
|
1900 public static void gc() {
1901 Runtime.getRuntime().gc();
1902 }
1903
1904 /**
1905 * Runs the finalization methods of any objects pending finalization.
1906 *
1907 * Calling this method suggests that the Java Virtual Machine expend
1908 * effort toward running the {@code finalize} methods of objects
1909 * that have been found to be discarded but whose {@code finalize}
1910 * methods have not yet been run. When control returns from the
1911 * method call, the Java Virtual Machine has made a best effort to
1912 * complete all outstanding finalizations.
1913 * <p>
1914 * The call {@code System.runFinalization()} is effectively
1915 * equivalent to the call:
1916 * <blockquote><pre>
1917 * Runtime.getRuntime().runFinalization()
1918 * </pre></blockquote>
1919 *
1920 * @deprecated Finalization has been deprecated for removal. See
1921 * {@link java.lang.Object#finalize} for background information and details
1922 * about migration options.
1923 * <p>
1924 * When running in a JVM in which finalization has been disabled or removed,
1925 * no objects will be pending finalization, so this method does nothing.
1926 *
1927 * @see java.lang.Runtime#runFinalization()
1928 * @jls 12.6 Finalization of Class Instances
1929 */
1930 @Deprecated(since="18", forRemoval=true)
1931 @SuppressWarnings("removal")
1932 public static void runFinalization() {
1933 Runtime.getRuntime().runFinalization();
1934 }
1935
1936 /**
1937 * Loads the native library specified by the filename argument. The filename
1938 * argument must be an absolute path name.
1939 *
1940 * If the filename argument, when stripped of any platform-specific library
1941 * prefix, path, and file extension, indicates a library whose name is,
1942 * for example, L, and a native library called L is statically linked
1943 * with the VM, then the JNI_OnLoad_L function exported by the library
1944 * is invoked rather than attempting to load a dynamic library.
1945 * A filename matching the argument does not have to exist in the
1946 * file system.
1947 * See the <a href="{@docRoot}/../specs/jni/index.html"> JNI Specification</a>
1948 * for more details.
1949 *
1950 * Otherwise, the filename argument is mapped to a native library image in
1951 * an implementation-dependent manner.
2296 }
2297 public byte[] getRawClassTypeAnnotations(Class<?> klass) {
2298 return klass.getRawTypeAnnotations();
2299 }
2300 public byte[] getRawExecutableTypeAnnotations(Executable executable) {
2301 return Class.getExecutableTypeAnnotationBytes(executable);
2302 }
2303 public <E extends Enum<E>>
2304 E[] getEnumConstantsShared(Class<E> klass) {
2305 return klass.getEnumConstantsShared();
2306 }
2307 public void blockedOn(Interruptible b) {
2308 Thread.blockedOn(b);
2309 }
2310 public void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook) {
2311 Shutdown.add(slot, registerShutdownInProgress, hook);
2312 }
2313 public Thread newThreadWithAcc(Runnable target, @SuppressWarnings("removal") AccessControlContext acc) {
2314 return new Thread(target, acc);
2315 }
2316 @SuppressWarnings("removal")
2317 public void invokeFinalize(Object o) throws Throwable {
2318 o.finalize();
2319 }
2320 public ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl) {
2321 return cl.createOrGetClassLoaderValueMap();
2322 }
2323 public Class<?> defineClass(ClassLoader loader, String name, byte[] b, ProtectionDomain pd, String source) {
2324 return ClassLoader.defineClass1(loader, name, b, 0, b.length, pd, source);
2325 }
2326 public Class<?> defineClass(ClassLoader loader, Class<?> lookup, String name, byte[] b, ProtectionDomain pd,
2327 boolean initialize, int flags, Object classData) {
2328 return ClassLoader.defineClass0(loader, lookup, name, b, 0, b.length, pd, initialize, flags, classData);
2329 }
2330 public Class<?> findBootstrapClassOrNull(String name) {
2331 return ClassLoader.findBootstrapClassOrNull(name);
2332 }
2333 public Package definePackage(ClassLoader cl, String name, Module module) {
2334 return cl.definePackage(name, module);
2335 }
2336 public String fastUUID(long lsb, long msb) {
|