You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/04/30 09:40:03 UTC
svn commit: r770100 - in /commons/proper/lang/trunk/src:
java/org/apache/commons/lang/mutable/ test/org/apache/commons/lang/mutable/
Author: bayard
Date: Thu Apr 30 07:40:02 2009
New Revision: 770100
URL: http://svn.apache.org/viewvc?rev=770100&view=rev
Log:
Applying Hendrik Maryns' generics changes for Mutable classes from LANG-336
Modified:
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableInt.java
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableLong.java
commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableShort.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableByteTest.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableDoubleTest.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableFloatTest.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableLongTest.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableShortTest.java
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java Thu Apr 30 07:40:02 2009
@@ -29,7 +29,7 @@
* @author Apache Software Foundation
* @version $Id$
*/
-public class MutableBoolean implements Mutable, Serializable, Comparable {
+public class MutableBoolean implements Mutable, Serializable, Comparable<MutableBoolean> {
/**
* Required for serialization support.
@@ -93,8 +93,7 @@
* @throws ClassCastException
* if the argument is not a MutableInt
*/
- public int compareTo(Object obj) {
- MutableBoolean other = (MutableBoolean) obj;
+ public int compareTo(MutableBoolean other) {
boolean anotherVal = other.value;
return value == anotherVal ? 0 : (value ? 1 : -1);
}
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java Thu Apr 30 07:40:02 2009
@@ -23,7 +23,7 @@
* @since 2.1
* @version $Id$
*/
-public class MutableByte extends Number implements Comparable, Mutable {
+public class MutableByte extends Number implements Comparable<MutableByte>, Mutable {
/**
* Required for serialization support.
@@ -270,8 +270,7 @@
* @return negative if this is less, zero if equal, positive if greater
* @throws ClassCastException if the argument is not a MutableByte
*/
- public int compareTo(Object obj) {
- MutableByte other = (MutableByte) obj;
+ public int compareTo(MutableByte other) {
byte anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java Thu Apr 30 07:40:02 2009
@@ -25,7 +25,7 @@
* @since 2.1
* @version $Id$
*/
-public class MutableDouble extends Number implements Comparable, Mutable {
+public class MutableDouble extends Number implements Comparable<MutableDouble>, Mutable {
/**
* Required for serialization support.
@@ -300,8 +300,7 @@
* @return negative if this is less, zero if equal, positive if greater
* @throws ClassCastException if the argument is not a MutableDouble
*/
- public int compareTo(Object obj) {
- MutableDouble other = (MutableDouble) obj;
+ public int compareTo(MutableDouble other) {
double anotherVal = other.value;
return Double.compare(value, anotherVal);
}
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java Thu Apr 30 07:40:02 2009
@@ -25,7 +25,7 @@
* @since 2.1
* @version $Id$
*/
-public class MutableFloat extends Number implements Comparable, Mutable {
+public class MutableFloat extends Number implements Comparable<MutableFloat>, Mutable {
/**
* Required for serialization support.
@@ -301,8 +301,7 @@
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater
*/
- public int compareTo(Object obj) {
- MutableFloat other = (MutableFloat) obj;
+ public int compareTo(MutableFloat other) {
float anotherVal = other.value;
return Float.compare(value, anotherVal);
}
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableInt.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableInt.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableInt.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableInt.java Thu Apr 30 07:40:02 2009
@@ -23,7 +23,7 @@
* @since 2.1
* @version $Id$
*/
-public class MutableInt extends Number implements Comparable, Mutable {
+public class MutableInt extends Number implements Comparable<MutableInt>, Mutable {
/**
* Required for serialization support.
@@ -260,8 +260,7 @@
* @return negative if this is less, zero if equal, positive if greater
* @throws ClassCastException if the argument is not a MutableInt
*/
- public int compareTo(Object obj) {
- MutableInt other = (MutableInt) obj;
+ public int compareTo(MutableInt other) {
int anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableLong.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableLong.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableLong.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableLong.java Thu Apr 30 07:40:02 2009
@@ -23,7 +23,7 @@
* @since 2.1
* @version $Id$
*/
-public class MutableLong extends Number implements Comparable, Mutable {
+public class MutableLong extends Number implements Comparable<MutableLong>, Mutable {
/**
* Required for serialization support.
@@ -260,8 +260,7 @@
* @return negative if this is less, zero if equal, positive if greater
* @throws ClassCastException if the argument is not a MutableLong
*/
- public int compareTo(Object obj) {
- MutableLong other = (MutableLong) obj;
+ public int compareTo(MutableLong other) {
long anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableShort.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableShort.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableShort.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableShort.java Thu Apr 30 07:40:02 2009
@@ -23,7 +23,7 @@
* @since 2.1
* @version $Id$
*/
-public class MutableShort extends Number implements Comparable, Mutable {
+public class MutableShort extends Number implements Comparable<MutableShort>, Mutable {
/**
* Required for serialization support.
@@ -270,8 +270,7 @@
* @return negative if this is less, zero if equal, positive if greater
* @throws ClassCastException if the argument is not a MutableShort
*/
- public int compareTo(Object obj) {
- MutableShort other = (MutableShort) obj;
+ public int compareTo(MutableShort other) {
short anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java Thu Apr 30 07:40:02 2009
@@ -58,16 +58,6 @@
fail();
} catch (NullPointerException ex) {
}
- try {
- mutBool.compareTo(Boolean.FALSE);
- fail();
- } catch (ClassCastException ex) {
- }
- try {
- mutBool.compareTo("false");
- fail();
- } catch (ClassCastException ex) {
- }
}
// ----------------------------------------------------------------
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableByteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableByteTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableByteTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableByteTest.java Thu Apr 30 07:40:02 2009
@@ -119,14 +119,6 @@
mutNum.compareTo(null);
fail();
} catch (NullPointerException ex) {}
- try {
- mutNum.compareTo(Byte.valueOf((byte) 0));
- fail();
- } catch (ClassCastException ex) {}
- try {
- mutNum.compareTo("0");
- fail();
- } catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableDoubleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableDoubleTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableDoubleTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableDoubleTest.java Thu Apr 30 07:40:02 2009
@@ -130,14 +130,6 @@
mutNum.compareTo(null);
fail();
} catch (NullPointerException ex) {}
- try {
- mutNum.compareTo(new Double(0d));
- fail();
- } catch (ClassCastException ex) {}
- try {
- mutNum.compareTo("0");
- fail();
- } catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableFloatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableFloatTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableFloatTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableFloatTest.java Thu Apr 30 07:40:02 2009
@@ -130,14 +130,6 @@
mutNum.compareTo(null);
fail();
} catch (NullPointerException ex) {}
- try {
- mutNum.compareTo(new Float(0f));
- fail();
- } catch (ClassCastException ex) {}
- try {
- mutNum.compareTo("0");
- fail();
- } catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableIntTest.java Thu Apr 30 07:40:02 2009
@@ -126,14 +126,6 @@
mutNum.compareTo(null);
fail();
} catch (NullPointerException ex) {}
- try {
- mutNum.compareTo(new Integer(0));
- fail();
- } catch (ClassCastException ex) {}
- try {
- mutNum.compareTo("0");
- fail();
- } catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableLongTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableLongTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableLongTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableLongTest.java Thu Apr 30 07:40:02 2009
@@ -119,14 +119,6 @@
mutNum.compareTo(null);
fail();
} catch (NullPointerException ex) {}
- try {
- mutNum.compareTo(new Long(0));
- fail();
- } catch (ClassCastException ex) {}
- try {
- mutNum.compareTo("0");
- fail();
- } catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableShortTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableShortTest.java?rev=770100&r1=770099&r2=770100&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableShortTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableShortTest.java Thu Apr 30 07:40:02 2009
@@ -119,14 +119,6 @@
mutNum.compareTo(null);
fail();
} catch (NullPointerException ex) {}
- try {
- mutNum.compareTo(new Short((short) 0));
- fail();
- } catch (ClassCastException ex) {}
- try {
- mutNum.compareTo("0");
- fail();
- } catch (ClassCastException ex) {}
}
public void testPrimitiveValues() {