< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page
*** 1915,12 ***
--- 1915,22 ---
       * equivalent to the call:
       * <blockquote><pre>
       * Runtime.getRuntime().runFinalization()
       * </pre></blockquote>
       *
+      * @deprecated Finalization has been deprecated for removal.  See
+      * {@link java.lang.Object#finalize} for background information and details
+      * about migration options.
+      * <p>
+      * When running in a JVM in which finalization has been disabled or removed,
+      * no objects will be pending finalization, so this method does nothing.
+      *
       * @see     java.lang.Runtime#runFinalization()
+      * @jls 12.6 Finalization of Class Instances
       */
+     @Deprecated(since="18", forRemoval=true)
+     @SuppressWarnings("removal")
      public static void runFinalization() {
          Runtime.getRuntime().runFinalization();
      }
  
      /**

*** 2301,11 ***
                  Shutdown.add(slot, registerShutdownInProgress, hook);
              }
              public Thread newThreadWithAcc(Runnable target, @SuppressWarnings("removal") AccessControlContext acc) {
                  return new Thread(target, acc);
              }
!             @SuppressWarnings("deprecation")
              public void invokeFinalize(Object o) throws Throwable {
                  o.finalize();
              }
              public ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl) {
                  return cl.createOrGetClassLoaderValueMap();
--- 2311,11 ---
                  Shutdown.add(slot, registerShutdownInProgress, hook);
              }
              public Thread newThreadWithAcc(Runnable target, @SuppressWarnings("removal") AccessControlContext acc) {
                  return new Thread(target, acc);
              }
!             @SuppressWarnings("removal")
              public void invokeFinalize(Object o) throws Throwable {
                  o.finalize();
              }
              public ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl) {
                  return cl.createOrGetClassLoaderValueMap();
< prev index next >