< prev index next >

src/java.base/share/classes/java/lang/ref/Cleaner.java

Print this page

        

@@ -23,14 +23,15 @@
  * questions.
  */
 
 package java.lang.ref;
 
+import jdk.internal.ref.CleanerImpl;
+
 import java.util.Objects;
 import java.util.concurrent.ThreadFactory;
-
-import jdk.internal.ref.CleanerImpl;
+import java.util.function.Function;
 
 /**
  * {@code Cleaner} manages a set of object references and corresponding cleaning actions.
  * <p>
  * Cleaning actions are {@link #register(Object object, Runnable action) registered}

@@ -133,11 +134,16 @@
      * The Cleaner implementation.
      */
     final CleanerImpl impl;
 
     static {
-        CleanerImpl.setCleanerImplAccess((Cleaner c) -> c.impl);
+        CleanerImpl.setCleanerImplAccess(new Function<Cleaner, CleanerImpl>() {
+            @Override
+            public CleanerImpl apply(Cleaner cleaner) {
+                return cleaner.impl;
+            }
+        });
     }
 
     /**
      * Construct a Cleaner implementation and start it.
      */
< prev index next >