[ignore previous diffs]
TIMEOUT: 17:00 PST May 3
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2965
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2965
dpatil: com/sun/enterprise/util/collection/IntEntry.java:67:70 HE:
com.sun.enterprise.util.collection.IntEntry defines equals and uses
Object.hashCode() (H)
dpatil: com/sun/enterprise/util/collection/LongEntry.java:62:65 HE:
com.sun.enterprise.util.collection.LongEntry defines equals and uses
Object.hashCode() (H)
Index: appserv-commons/src/java/com/sun/enterprise/util/collection/
IntEntry.java
===================================================================
RCS file: /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/
util/collection/IntEntry.java,v
retrieving revision 1.3
diff -w -u -r1.3 IntEntry.java
--- appserv-commons/src/java/com/sun/enterprise/util/collection/
IntEntry.java 25 Dec 2005 04:12:12 -0000 1.3
+++ appserv-commons/src/java/com/sun/enterprise/util/collection/
IntEntry.java 3 May 2007 18:53:31 -0000
@@ -21,46 +21,23 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
*/
-//NOTE: Tabs are used instead of spaces for indentation.
-// Make sure that your editor does not replace tabs with spaces.
-// Set the tab length using your favourite editor to your
-// visual preference.
-
-/*
- * Filename: TooManyTasksException.java
- *
- * Copyright 2000-2001 by iPlanet/Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of iPlanet/Sun Microsystems, Inc. ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license
- * agreement you entered into with iPlanet/Sun Microsystems.
- */
-
/**
- * <BR> <I>$Source: /cvs/glassfish/appserv-commons/src/java/com/sun/
enterprise/util/collection/IntEntry.java,v $</I>
- * @author $Author: tcfujii $
- * @version $Revision: 1.3 $ $Date: 2005/12/25 04:12:12 $
+ <b>NOT THREAD SAFE: mutable variables</b>
*/
-
package com.sun.enterprise.util.collection;
-public class IntEntry {
-
- public int key;
+public final class IntEntry {
+ public final int key;
public Object object;
- IntEntry (int key, Object object) {
- this.key = key;
- this.object = object;
+ IntEntry (int keyIn, Object objectIn) {
+ key = keyIn;
+ object = objectIn;
}
- IntEntry (long key, Object object) {
- this.key = (int) key;
- this.object = object;
+ IntEntry (long keyIn, Object objectIn) {
+ key = (int)keyIn;
+ object = objectIn;
}
public boolean equals(Object object) {
@@ -70,6 +47,11 @@
return false;
}
+ public int hashCode() {
+ final int objectHash = ((object == null) ? 0 :
object.hashCode());
+ return (int)key ^ (int)(key>>32) ^ objectHash;
+ }
+
public String toString() {
return "key: " + key + "; obj: " + object;
}
Index: appserv-commons/src/java/com/sun/enterprise/util/collection/
LongEntry.java
===================================================================
RCS file: /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/
util/collection/LongEntry.java,v
retrieving revision 1.3
diff -w -u -r1.3 LongEntry.java
--- appserv-commons/src/java/com/sun/enterprise/util/collection/
LongEntry.java 25 Dec 2005 04:12:12 -0000 1.3
+++ appserv-commons/src/java/com/sun/enterprise/util/collection/
LongEntry.java 3 May 2007 18:53:31 -0000
@@ -21,41 +21,18 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
*/
-//NOTE: Tabs are used instead of spaces for indentation.
-// Make sure that your editor does not replace tabs with spaces.
-// Set the tab length using your favourite editor to your
-// visual preference.
-
-/*
- * Filename: TooManyTasksException.java
- *
- * Copyright 2000-2001 by iPlanet/Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of iPlanet/Sun Microsystems, Inc. ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license
- * agreement you entered into with iPlanet/Sun Microsystems.
- */
-
/**
- * <BR> <I>$Source: /cvs/glassfish/appserv-commons/src/java/com/sun/
enterprise/util/collection/LongEntry.java,v $</I>
- * @author $Author: tcfujii $
- * @version $Revision: 1.3 $ $Date: 2005/12/25 04:12:12 $
+ <b>NOT THREAD SAFE: mutable variables</b>
*/
-
package com.sun.enterprise.util.collection;
-public class LongEntry {
-
- public long key;
+public final class LongEntry {
+ public final long key;
public Object object;
- LongEntry (long key, Object object) {
- this.key = key;
- this.object = object;
+ LongEntry (long keyIn, Object objectIn) {
+ key = keyIn;
+ object = objectIn;
}
public boolean equals(Object object) {
@@ -65,6 +42,11 @@
return false;
}
+ public int hashCode() {
+ final int objectHash = ((object == null) ? 0 :
object.hashCode());
+ return (int)key ^ (int)(key>>32) ^ objectHash;
+ }
+
public String toString() {
return "key: " + key + "; obj: " + object;
}