-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring back 24 Collections bugs previously deprecated, patching compil…
…ation errors.
- Loading branch information
Showing
10 changed files
with
1,133 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187 changes: 187 additions & 0 deletions
187
framework/projects/Collections/compile-errors/compile-1-16.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
diff --git a/src/java/org/apache/commons/collections/MultiHashMap.java b/src/java/org/apache/commons/collections/MultiHashMap.java | ||
index e23bfa5a..d2597f51 100644 | ||
--- a/src/java/org/apache/commons/collections/MultiHashMap.java | ||
+++ b/src/java/org/apache/commons/collections/MultiHashMap.java | ||
@@ -330,7 +330,7 @@ public class MultiHashMap extends HashMap implements MultiMap { | ||
* @param item the value to remove | ||
* @return the value removed (which was passed in), null if nothing removed | ||
*/ | ||
- public Object remove(Object key, Object item) { | ||
+ public Object removeMapping(Object key, Object item) { | ||
Collection valuesForKey = getCollection(key); | ||
if (valuesForKey == null) { | ||
return null; | ||
diff --git a/src/java/org/apache/commons/collections/MultiMap.java b/src/java/org/apache/commons/collections/MultiMap.java | ||
index 21701663..4b0fee67 100644 | ||
--- a/src/java/org/apache/commons/collections/MultiMap.java | ||
+++ b/src/java/org/apache/commons/collections/MultiMap.java | ||
@@ -65,7 +65,7 @@ public interface MultiMap extends Map { | ||
* @throws ClassCastException if the key or value is of an invalid type | ||
* @throws NullPointerException if the key or value is null and null is invalid | ||
*/ | ||
- public Object remove(Object key, Object item); | ||
+ public Object removeMapping(Object key, Object item); | ||
|
||
//----------------------------------------------------------------------- | ||
/** | ||
diff --git a/src/java/org/apache/commons/collections/map/MultiKeyMap.java b/src/java/org/apache/commons/collections/map/MultiKeyMap.java | ||
index 8df5efb5..526b89ca 100644 | ||
--- a/src/java/org/apache/commons/collections/map/MultiKeyMap.java | ||
+++ b/src/java/org/apache/commons/collections/map/MultiKeyMap.java | ||
@@ -196,7 +196,7 @@ public class MultiKeyMap | ||
* @param key2 the second key | ||
* @return the value mapped to the removed key, null if key not in map | ||
*/ | ||
- public Object remove(Object key1, Object key2) { | ||
+ public Object removeMultiKey(Object key1, Object key2) { | ||
int hashCode = hash(key1, key2); | ||
int index = map.hashIndex(hashCode, map.data.length); | ||
AbstractHashedMap.HashEntry entry = map.data[index]; | ||
@@ -326,7 +326,7 @@ public class MultiKeyMap | ||
* @param key3 the third key | ||
* @return the value mapped to the removed key, null if key not in map | ||
*/ | ||
- public Object remove(Object key1, Object key2, Object key3) { | ||
+ public Object removeMultiKey(Object key1, Object key2, Object key3) { | ||
int hashCode = hash(key1, key2, key3); | ||
int index = map.hashIndex(hashCode, map.data.length); | ||
AbstractHashedMap.HashEntry entry = map.data[index]; | ||
@@ -466,7 +466,7 @@ public class MultiKeyMap | ||
* @param key4 the fourth key | ||
* @return the value mapped to the removed key, null if key not in map | ||
*/ | ||
- public Object remove(Object key1, Object key2, Object key3, Object key4) { | ||
+ public Object removeMultiKey(Object key1, Object key2, Object key3, Object key4) { | ||
int hashCode = hash(key1, key2, key3, key4); | ||
int index = map.hashIndex(hashCode, map.data.length); | ||
AbstractHashedMap.HashEntry entry = map.data[index]; | ||
@@ -616,7 +616,7 @@ public class MultiKeyMap | ||
* @param key5 the fifth key | ||
* @return the value mapped to the removed key, null if key not in map | ||
*/ | ||
- public Object remove(Object key1, Object key2, Object key3, Object key4, Object key5) { | ||
+ public Object removeMultiKey(Object key1, Object key2, Object key3, Object key4, Object key5) { | ||
int hashCode = hash(key1, key2, key3, key4, key5); | ||
int index = map.hashIndex(hashCode, map.data.length); | ||
AbstractHashedMap.HashEntry entry = map.data[index]; | ||
diff --git a/src/java/org/apache/commons/collections/map/MultiValueMap.java b/src/java/org/apache/commons/collections/map/MultiValueMap.java | ||
index 81e86be9..04a1395f 100644 | ||
--- a/src/java/org/apache/commons/collections/map/MultiValueMap.java | ||
+++ b/src/java/org/apache/commons/collections/map/MultiValueMap.java | ||
@@ -152,7 +152,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap { | ||
* @param value the value to remove | ||
* @return the value removed (which was passed in), null if nothing removed | ||
*/ | ||
- public Object remove(Object key, Object value) { | ||
+ public Object removeMapping(Object key, Object value) { | ||
Collection valuesForKey = getCollection(key); | ||
if (valuesForKey == null) { | ||
return null; | ||
diff --git a/src/test/org/apache/commons/collections/TestMultiHashMap.java b/src/test/org/apache/commons/collections/TestMultiHashMap.java | ||
index 4b6fa261..09a0ff5f 100644 | ||
--- a/src/test/org/apache/commons/collections/TestMultiHashMap.java | ||
+++ b/src/test/org/apache/commons/collections/TestMultiHashMap.java | ||
@@ -216,7 +216,7 @@ public class TestMultiHashMap extends AbstractTestMap { | ||
MultiHashMap one = new MultiHashMap(); | ||
Integer value = new Integer(1); | ||
one.put("One", value); | ||
- one.remove("One", value); | ||
+ one.removeMapping("One", value); | ||
|
||
MultiHashMap two = new MultiHashMap(); | ||
assertEquals(two, one); | ||
@@ -268,7 +268,7 @@ public class TestMultiHashMap extends AbstractTestMap { | ||
assertEquals(4, map.totalSize()); | ||
map.remove("A"); | ||
assertEquals(3, map.totalSize()); | ||
- map.remove("B", "BC"); | ||
+ map.removeMapping("B", "BC"); | ||
assertEquals(2, map.totalSize()); | ||
} | ||
|
||
@@ -291,7 +291,7 @@ public class TestMultiHashMap extends AbstractTestMap { | ||
map.remove("A"); | ||
assertEquals(0, map.size("A")); | ||
assertEquals(3, map.size("B")); | ||
- map.remove("B", "BC"); | ||
+ map.removeMapping("B", "BC"); | ||
assertEquals(0, map.size("A")); | ||
assertEquals(2, map.size("B")); | ||
} | ||
@@ -463,11 +463,11 @@ public class TestMultiHashMap extends AbstractTestMap { | ||
map.put("A", "AA"); | ||
map.put("A", "AB"); | ||
map.put("A", "AC"); | ||
- assertEquals(null, map.remove("C", "CA")); | ||
- assertEquals(null, map.remove("A", "AD")); | ||
- assertEquals("AC", map.remove("A", "AC")); | ||
- assertEquals("AB", map.remove("A", "AB")); | ||
- assertEquals("AA", map.remove("A", "AA")); | ||
+ assertEquals(null, map.removeMapping("C", "CA")); | ||
+ assertEquals(null, map.removeMapping("A", "AD")); | ||
+ assertEquals("AC", map.removeMapping("A", "AC")); | ||
+ assertEquals("AB", map.removeMapping("A", "AB")); | ||
+ assertEquals("AA", map.removeMapping("A", "AA")); | ||
assertEquals(new MultiHashMap(), map); | ||
} | ||
|
||
diff --git a/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java b/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java | ||
index 859aeccb..caafd8cf 100644 | ||
--- a/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java | ||
+++ b/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java | ||
@@ -1115,7 +1115,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject { | ||
verify(); | ||
|
||
try { | ||
- array = collection.toArray(null); | ||
+ array = collection.toArray((Object[])null); | ||
fail("toArray(null) should raise NPE"); | ||
} catch (NullPointerException e) { | ||
// expected | ||
diff --git a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java | ||
index 7cd7e780..09aa810d 100644 | ||
--- a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java | ||
+++ b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java | ||
@@ -314,34 +314,34 @@ public class TestMultiKeyMap extends AbstractTestIterableMap { | ||
switch (key.size()) { | ||
case 2: | ||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1))); | ||
- assertEquals(value, multimap.remove(key.getKey(0), key.getKey(1))); | ||
+ assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1))); | ||
assertEquals(size - 1, multimap.size()); | ||
- assertEquals(null, multimap.remove(key.getKey(0), key.getKey(1))); | ||
+ assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1))); | ||
break; | ||
case 3: | ||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
- assertEquals(value, multimap.remove(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
+ assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
assertEquals(size - 1, multimap.size()); | ||
- assertEquals(null, multimap.remove(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
+ assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2))); | ||
break; | ||
case 4: | ||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
- assertEquals(value, multimap.remove(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
+ assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
assertEquals(size - 1, multimap.size()); | ||
- assertEquals(null, multimap.remove(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
+ assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))); | ||
break; | ||
case 5: | ||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
- assertEquals(value, multimap.remove(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
+ assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
assertEquals(size - 1, multimap.size()); | ||
- assertEquals(null, multimap.remove(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
+ assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))); | ||
break; | ||
default: |
Oops, something went wrong.