commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject svn commit: r169101 - in /jakarta/commons/proper/collections/trunk: project.xml src/test/org/apache/commons/collections/TestReferenceMap.java src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java src/test/org/apache/commons/collections/map/TestReferenceMap.java
Date Sat, 07 May 2005 17:26:58 GMT
Author: scolebourne
Date: Sat May  7 10:26:58 2005
New Revision: 169101

URL: http://svn.apache.org/viewcvs?rev=169101&view=rev
Log:
Fix so references are properly cleared on Kaffe JVM
bug 34689, by Guilhem Lavaux

Modified:
    jakarta/commons/proper/collections/trunk/project.xml
    jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestReferenceMap.java
    jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
    jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceMap.java

Modified: jakarta/commons/proper/collections/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/project.xml?rev=169101&r1=169100&r2=169101&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/project.xml (original)
+++ jakarta/commons/proper/collections/trunk/project.xml Sat May  7 10:26:58 2005
@@ -219,6 +219,9 @@
       <name>Olaf Krische</name>
     </contributor>
     <contributor>
+      <name>Guilhem Lavaux</name>
+    </contributor>
+    <contributor>
       <name>David Leppik</name>
     </contributor>
     <contributor>

Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestReferenceMap.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestReferenceMap.java?rev=169101&r1=169100&r2=169101&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestReferenceMap.java
(original)
+++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestReferenceMap.java
Sat May  7 10:26:58 2005
@@ -28,6 +28,7 @@
  * @version $Revision$ $Date$
  *
  * @author Paul Jack
+ * @author Guilhem Lavaux
  */
 public class TestReferenceMap extends AbstractTestMap {
 
@@ -152,25 +153,30 @@
     }
 */
 
-    /** Tests whether purge values setting works */
-    public void testPurgeValues() throws Exception {
-        // many thanks to Juozas Baliuka for suggesting this method
+    WeakReference keyReference;
+    WeakReference valueReference;
+
+    public Map buildRefMap() {
         Object key = new Object();
         Object value = new Object();
         
-        WeakReference keyReference = new WeakReference(key);
-        WeakReference valueReference = new WeakReference(value);
+        keyReference = new WeakReference(key);
+        valueReference = new WeakReference(value);
         
         Map testMap = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);
         testMap.put(key, value);
-        
+ 
         assertEquals("In map", value, testMap.get(key));
         assertNotNull("Weak reference released early (1)", keyReference.get());
         assertNotNull("Weak reference released early (2)", valueReference.get());
-        
-        // dereference strong references
-        key = null;
-        value = null;
+        return testMap;
+    }
+
+    /** Tests whether purge values setting works */
+    public void testPurgeValues() throws Exception {
+        // many thanks to Juozas Baliuka for suggesting this method
+      
+        Map testMap = buildRefMap();
         
         int iterations = 0;
         int bytz = 2;

Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java?rev=169101&r1=169100&r2=169101&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
(original)
+++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceIdentityMap.java
Sat May  7 10:26:58 2005
@@ -31,6 +31,7 @@
  *
  * @author Paul Jack
  * @author Stephen Colebourne
+ * @author Guilhem Lavaux
  */
 public class TestReferenceIdentityMap extends AbstractTestIterableMap {
 
@@ -261,25 +262,29 @@
     }
 */
 
-    /** Tests whether purge values setting works */
-    public void testPurgeValues() throws Exception {
-        // many thanks to Juozas Baliuka for suggesting this method
+    WeakReference keyReference;
+    WeakReference valueReference;
+
+    public Map buildRefMap() {
         Object key = new Object();
         Object value = new Object();
         
-        WeakReference keyReference = new WeakReference(key);
-        WeakReference valueReference = new WeakReference(value);
+        keyReference = new WeakReference(key);
+        valueReference = new WeakReference(value);
         
-        Map testMap = new ReferenceIdentityMap(ReferenceIdentityMap.WEAK, ReferenceIdentityMap.HARD,
true);
+        Map testMap = new ReferenceIdentityMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);
         testMap.put(key, value);
-        
+ 
         assertEquals("In map", value, testMap.get(key));
         assertNotNull("Weak reference released early (1)", keyReference.get());
         assertNotNull("Weak reference released early (2)", valueReference.get());
-        
-        // dereference strong references
-        key = null;
-        value = null;
+        return testMap;
+    }
+
+    /** Tests whether purge values setting works */
+    public void testPurgeValues() throws Exception {
+        // many thanks to Juozas Baliuka for suggesting this method
+        Map testMap = buildRefMap();
         
         int iterations = 0;
         int bytz = 2;

Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceMap.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceMap.java?rev=169101&r1=169100&r2=169101&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceMap.java
(original)
+++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestReferenceMap.java
Sat May  7 10:26:58 2005
@@ -28,6 +28,7 @@
  * @version $Revision$ $Date$
  *
  * @author Paul Jack
+ * @author Guilhem Lavaux
  */
 public class TestReferenceMap extends AbstractTestIterableMap {
 
@@ -196,26 +197,30 @@
     }
 */
 
-    /** Tests whether purge values setting works */
-    public void testPurgeValues() throws Exception {
-        // many thanks to Juozas Baliuka for suggesting this method
+    WeakReference keyReference;
+    WeakReference valueReference;
+
+    public Map buildRefMap() {
         Object key = new Object();
         Object value = new Object();
         
-        WeakReference keyReference = new WeakReference(key);
-        WeakReference valueReference = new WeakReference(value);
+        keyReference = new WeakReference(key);
+        valueReference = new WeakReference(value);
         
         Map testMap = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);
         testMap.put(key, value);
-        
+ 
         assertEquals("In map", value, testMap.get(key));
         assertNotNull("Weak reference released early (1)", keyReference.get());
         assertNotNull("Weak reference released early (2)", valueReference.get());
-        
-        // dereference strong references
-        key = null;
-        value = null;
-        
+        return testMap;
+    }
+
+    /** Tests whether purge values setting works */
+    public void testPurgeValues() throws Exception {
+        // many thanks to Juozas Baliuka for suggesting this method
+        Map testMap = buildRefMap();
+
         int iterations = 0;
         int bytz = 2;
         while(true) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message