Merge
authorhenryjen
Wed, 20 Jan 2016 08:33:40 -0800
changeset 35300 30eaec7fded0
parent 35278 9cadaa13225e (diff)
parent 35299 d5737dedc6df (current diff)
child 35301 12dabfdd1997
Merge
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Tue Dec 22 09:50:09 2015 +0300
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Wed Jan 20 08:33:40 2016 -0800
@@ -26,6 +26,7 @@
 package jdk.internal.ref;
 
 import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
 import java.lang.ref.PhantomReference;
 import java.util.Objects;
 
@@ -66,9 +67,9 @@
         this.list = CleanerImpl.getCleanerImpl(cleaner).phantomCleanableList;
         insert();
 
-        // TODO: Replace getClass() with ReachabilityFence when it is available
-        cleaner.getClass();
-        referent.getClass();
+        // Ensure referent and cleaner remain accessible
+        Reference.reachabilityFence(referent);
+        Reference.reachabilityFence(cleaner);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java	Tue Dec 22 09:50:09 2015 +0300
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java	Wed Jan 20 08:33:40 2016 -0800
@@ -26,6 +26,7 @@
 package jdk.internal.ref;
 
 import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
 import java.util.Objects;
 
@@ -66,9 +67,9 @@
         list = CleanerImpl.getCleanerImpl(cleaner).softCleanableList;
         insert();
 
-        // TODO: Replace getClass() with ReachabilityFence when it is available
-        cleaner.getClass();
-        referent.getClass();
+        // Ensure referent and cleaner remain accessible
+        Reference.reachabilityFence(referent);
+        Reference.reachabilityFence(cleaner);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java	Tue Dec 22 09:50:09 2015 +0300
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java	Wed Jan 20 08:33:40 2016 -0800
@@ -26,6 +26,7 @@
  */
 
 import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
 import java.util.Objects;
 
@@ -66,9 +67,10 @@
         list = CleanerImpl.getCleanerImpl(cleaner).weakCleanableList;
         insert();
 
-        // TODO: Replace getClass() with ReachabilityFence when it is available
-        cleaner.getClass();
-        referent.getClass();
+        // Ensure referent and cleaner remain accessible
+        Reference.reachabilityFence(referent);
+        Reference.reachabilityFence(cleaner);
+
     }
 
     /**