Fixed a bunch of type safety bits pointed out by the latest version of Eclipse.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5274 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-07-30 12:58:51 +00:00
parent ca4c5897fb
commit 725f656197
77 changed files with 248 additions and 250 deletions
+2 -2
View File
@@ -113,8 +113,8 @@ public class Name extends SimpleStreamableObject
public boolean equals (Object other)
{
if (other != null) {
Class c = getClass();
Class oc = other.getClass();
Class<?> c = getClass();
Class<?> oc = other.getClass();
// we have to be of the same derived class but we don't want to
// wig out if the classes were loaded from different class loaders
if (c == oc || c.getName().equals(oc.getName())) {
@@ -70,7 +70,7 @@ public class StreamableEnumSet<E extends Enum<E>> extends AbstractSet<E>
public static <E extends Enum<E>> StreamableEnumSet<E> copyOf (Collection<E> s)
{
if (s instanceof StreamableEnumSet) {
@SuppressWarnings("unchecked") StreamableEnumSet<E> set = (StreamableEnumSet<E>)s;
StreamableEnumSet<E> set = (StreamableEnumSet<E>)s;
return copyOf(set);
}
if (s.isEmpty()) {
@@ -197,7 +197,7 @@ public class StreamableEnumSet<E extends Enum<E>> extends AbstractSet<E>
if (!_elementType.isInstance(o)) {
return false;
}
int ordinal = ((Enum)o).ordinal();
int ordinal = ((Enum<?>)o).ordinal();
int idx = ordinal >> 3, mask = 1 << (ordinal & 0x07);
return (_contents[idx] & mask) != 0;
}
@@ -222,7 +222,7 @@ public class StreamableEnumSet<E extends Enum<E>> extends AbstractSet<E>
if (!_elementType.isInstance(o)) {
return false;
}
int ordinal = ((Enum)o).ordinal();
int ordinal = ((Enum<?>)o).ordinal();
int idx = ordinal >> 3, mask = 1 << (ordinal & 0x07);
if ((_contents[idx] & mask) != 0) {
_contents[idx] &= ~mask;
@@ -22,7 +22,6 @@
package com.threerings.util;
import java.io.IOException;
import java.util.Iterator;
import com.samskivert.util.HashIntMap;
@@ -66,8 +65,7 @@ public class StreamableHashIntMap<V> extends HashIntMap<V>
{
int ecount = size();
out.writeInt(ecount);
for (Iterator iter = intEntrySet().iterator(); iter.hasNext(); ) {
IntEntry entry = (IntEntry) iter.next();
for (IntEntry<V> entry : intEntrySet()) {
out.writeInt(entry.getIntKey());
out.writeObject(entry.getValue());
}
@@ -22,7 +22,6 @@
package com.threerings.util;
import java.io.IOException;
import java.util.Iterator;
import com.samskivert.util.IntIntMap;
@@ -65,8 +64,7 @@ public class StreamableIntIntMap extends IntIntMap
{
int ecount = size();
out.writeInt(ecount);
for (Iterator itr = entrySet().iterator(); itr.hasNext(); ) {
IntIntEntry entry = (IntIntEntry) itr.next();
for (IntIntEntry entry : entrySet()) {
out.writeInt(entry.getIntKey());
out.writeInt(entry.getIntValue());
}
@@ -21,9 +21,10 @@
package com.threerings.util;
import java.util.HashMap;
import java.util.Map;
import com.google.common.collect.Maps;
import com.samskivert.util.Tuple;
import static com.threerings.NaryaLog.log;
@@ -56,7 +57,7 @@ public class TrackedObject
/** Records that this object came into existence. */
protected final void incrementInstanceCount ()
{
Class clazz = getClass();
Class<?> clazz = getClass();
synchronized (_map) {
int[] count = _map.get(clazz);
if (count == null) {
@@ -71,7 +72,7 @@ public class TrackedObject
protected void finalize ()
throws Throwable
{
Class clazz = getClass();
Class<?> clazz = getClass();
synchronized (_map) {
int[] count = _map.get(clazz);
if (count != null) {
@@ -90,23 +91,23 @@ public class TrackedObject
* instances and an <code>int[]</code> array that represent the number
* of outstanding instance of all {@link TrackedObject}s in the VM.
*/
public static Tuple<Class[], int[]> getSnapshot ()
public static Tuple<Class<?>[], int[]> getSnapshot ()
{
Class[] classes = null;
Class<?>[] classes = null;
int[] counts = null;
synchronized (_map) {
classes = new Class[_map.size()];
counts = new int[_map.size()];
int idx = 0;
for (Map.Entry<Class, int[]> entry : _map.entrySet()) {
for (Map.Entry<Class<?>, int[]> entry : _map.entrySet()) {
classes[idx] = entry.getKey();
counts[idx] = entry.getValue()[0];
idx++;
}
}
return new Tuple<Class[], int[]>(classes, counts);
return new Tuple<Class<?>[], int[]>(classes, counts);
}
/** Tracks a mapping from {@link Class} object to active count. */
protected static HashMap<Class, int[]> _map = new HashMap<Class, int[]>();
protected static Map<Class<?>, int[]> _map = Maps.newHashMap();
}