diff --git a/src/as/com/threerings/bureau/data/BureauMarshaller.as b/src/as/com/threerings/bureau/data/BureauMarshaller.as
index 3e6da4d7f..0077a191b 100644
--- a/src/as/com/threerings/bureau/data/BureauMarshaller.as
+++ b/src/as/com/threerings/bureau/data/BureauMarshaller.as
@@ -27,7 +27,7 @@ import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.util.Integer;
/**
- * Provides the implementation of the {@link BureauService} interface
+ * Provides the implementation of the BureauService interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
@@ -36,7 +36,7 @@ import com.threerings.util.Integer;
public class BureauMarshaller extends InvocationMarshaller
implements BureauService
{
- /** The method id used to dispatch {@link #agentCreated} requests. */
+ /** The method id used to dispatch agentCreated requests. */
public static const AGENT_CREATED :int = 1;
// from interface BureauService
@@ -47,7 +47,7 @@ public class BureauMarshaller extends InvocationMarshaller
]);
}
- /** The method id used to dispatch {@link #agentCreationFailed} requests. */
+ /** The method id used to dispatch agentCreationFailed requests. */
public static const AGENT_CREATION_FAILED :int = 2;
// from interface BureauService
@@ -58,7 +58,7 @@ public class BureauMarshaller extends InvocationMarshaller
]);
}
- /** The method id used to dispatch {@link #agentDestroyed} requests. */
+ /** The method id used to dispatch agentDestroyed requests. */
public static const AGENT_DESTROYED :int = 3;
// from interface BureauService
@@ -69,7 +69,7 @@ public class BureauMarshaller extends InvocationMarshaller
]);
}
- /** The method id used to dispatch {@link #bureauInitialized} requests. */
+ /** The method id used to dispatch bureauInitialized requests. */
public static const BUREAU_INITIALIZED :int = 4;
// from interface BureauService
diff --git a/src/as/com/threerings/crowd/chat/data/ChatMarshaller.as b/src/as/com/threerings/crowd/chat/data/ChatMarshaller.as
index 94a2a4797..b93b2e14e 100644
--- a/src/as/com/threerings/crowd/chat/data/ChatMarshaller.as
+++ b/src/as/com/threerings/crowd/chat/data/ChatMarshaller.as
@@ -30,7 +30,7 @@ import com.threerings.presents.data.InvocationMarshaller_ListenerMarshaller;
import com.threerings.util.Name;
/**
- * Provides the implementation of the {@link ChatService} interface
+ * Provides the implementation of the ChatService interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
@@ -39,7 +39,7 @@ import com.threerings.util.Name;
public class ChatMarshaller extends InvocationMarshaller
implements ChatService
{
- /** The method id used to dispatch {@link #away} requests. */
+ /** The method id used to dispatch away requests. */
public static const AWAY :int = 1;
// from interface ChatService
@@ -50,7 +50,7 @@ public class ChatMarshaller extends InvocationMarshaller
]);
}
- /** The method id used to dispatch {@link #broadcast} requests. */
+ /** The method id used to dispatch broadcast requests. */
public static const BROADCAST :int = 2;
// from interface ChatService
@@ -63,7 +63,7 @@ public class ChatMarshaller extends InvocationMarshaller
]);
}
- /** The method id used to dispatch {@link #tell} requests. */
+ /** The method id used to dispatch tell requests. */
public static const TELL :int = 3;
// from interface ChatService
diff --git a/src/as/com/threerings/crowd/chat/data/ChatMarshaller_TellMarshaller.as b/src/as/com/threerings/crowd/chat/data/ChatMarshaller_TellMarshaller.as
index 822c34430..8656a36ad 100644
--- a/src/as/com/threerings/crowd/chat/data/ChatMarshaller_TellMarshaller.as
+++ b/src/as/com/threerings/crowd/chat/data/ChatMarshaller_TellMarshaller.as
@@ -31,7 +31,7 @@ import com.threerings.util.Long;
public class ChatMarshaller_TellMarshaller
extends InvocationMarshaller_ListenerMarshaller
{
- /** The method id used to dispatch {@link #tellSucceeded} responses. */
+ /** The method id used to dispatch tellSucceeded responses. */
public static const TELL_SUCCEEDED :int = 1;
// from InvocationMarshaller_ListenerMarshaller
diff --git a/src/as/com/threerings/crowd/chat/data/SpeakMarshaller.as b/src/as/com/threerings/crowd/chat/data/SpeakMarshaller.as
index 7e0146275..6267d466b 100644
--- a/src/as/com/threerings/crowd/chat/data/SpeakMarshaller.as
+++ b/src/as/com/threerings/crowd/chat/data/SpeakMarshaller.as
@@ -27,7 +27,7 @@ import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.util.Byte;
/**
- * Provides the implementation of the {@link SpeakService} interface
+ * Provides the implementation of the SpeakService interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
@@ -36,7 +36,7 @@ import com.threerings.util.Byte;
public class SpeakMarshaller extends InvocationMarshaller
implements SpeakService
{
- /** The method id used to dispatch {@link #speak} requests. */
+ /** The method id used to dispatch speak requests. */
public static const SPEAK :int = 1;
// from interface SpeakService
diff --git a/src/as/com/threerings/crowd/data/BodyMarshaller.as b/src/as/com/threerings/crowd/data/BodyMarshaller.as
index b60f285a3..776a05b0c 100644
--- a/src/as/com/threerings/crowd/data/BodyMarshaller.as
+++ b/src/as/com/threerings/crowd/data/BodyMarshaller.as
@@ -27,7 +27,7 @@ import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.util.langBoolean;
/**
- * Provides the implementation of the {@link BodyService} interface
+ * Provides the implementation of the BodyService interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
@@ -36,7 +36,7 @@ import com.threerings.util.langBoolean;
public class BodyMarshaller extends InvocationMarshaller
implements BodyService
{
- /** The method id used to dispatch {@link #setIdle} requests. */
+ /** The method id used to dispatch setIdle requests. */
public static const SET_IDLE :int = 1;
// from interface BodyService
diff --git a/src/as/com/threerings/crowd/data/LocationMarshaller.as b/src/as/com/threerings/crowd/data/LocationMarshaller.as
index 18387e238..80a2c96ed 100644
--- a/src/as/com/threerings/crowd/data/LocationMarshaller.as
+++ b/src/as/com/threerings/crowd/data/LocationMarshaller.as
@@ -28,7 +28,7 @@ import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.util.Integer;
/**
- * Provides the implementation of the {@link LocationService} interface
+ * Provides the implementation of the LocationService interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
@@ -37,7 +37,7 @@ import com.threerings.util.Integer;
public class LocationMarshaller extends InvocationMarshaller
implements LocationService
{
- /** The method id used to dispatch {@link #leavePlace} requests. */
+ /** The method id used to dispatch leavePlace requests. */
public static const LEAVE_PLACE :int = 1;
// from interface LocationService
@@ -48,7 +48,7 @@ public class LocationMarshaller extends InvocationMarshaller
]);
}
- /** The method id used to dispatch {@link #moveTo} requests. */
+ /** The method id used to dispatch moveTo requests. */
public static const MOVE_TO :int = 2;
// from interface LocationService
diff --git a/src/as/com/threerings/crowd/data/LocationMarshaller_MoveMarshaller.as b/src/as/com/threerings/crowd/data/LocationMarshaller_MoveMarshaller.as
index 65ba86eec..dd4e694d8 100644
--- a/src/as/com/threerings/crowd/data/LocationMarshaller_MoveMarshaller.as
+++ b/src/as/com/threerings/crowd/data/LocationMarshaller_MoveMarshaller.as
@@ -30,7 +30,7 @@ import com.threerings.presents.data.InvocationMarshaller_ListenerMarshaller;
public class LocationMarshaller_MoveMarshaller
extends InvocationMarshaller_ListenerMarshaller
{
- /** The method id used to dispatch {@link #moveSucceeded} responses. */
+ /** The method id used to dispatch moveSucceeded responses. */
public static const MOVE_SUCCEEDED :int = 1;
// from InvocationMarshaller_ListenerMarshaller
diff --git a/src/as/com/threerings/presents/data/TimeBaseMarshaller.as b/src/as/com/threerings/presents/data/TimeBaseMarshaller.as
index da1c9de82..496dede03 100644
--- a/src/as/com/threerings/presents/data/TimeBaseMarshaller.as
+++ b/src/as/com/threerings/presents/data/TimeBaseMarshaller.as
@@ -26,7 +26,7 @@ import com.threerings.presents.client.TimeBaseService;
import com.threerings.presents.client.TimeBaseService_GotTimeBaseListener;
/**
- * Provides the implementation of the {@link TimeBaseService} interface
+ * Provides the implementation of the TimeBaseService interface
* that marshalls the arguments and delivers the request to the provider
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
@@ -35,7 +35,7 @@ import com.threerings.presents.client.TimeBaseService_GotTimeBaseListener;
public class TimeBaseMarshaller extends InvocationMarshaller
implements TimeBaseService
{
- /** The method id used to dispatch {@link #getTimeOid} requests. */
+ /** The method id used to dispatch getTimeOid requests. */
public static const GET_TIME_OID :int = 1;
// from interface TimeBaseService
diff --git a/src/as/com/threerings/presents/data/TimeBaseMarshaller_GotTimeBaseMarshaller.as b/src/as/com/threerings/presents/data/TimeBaseMarshaller_GotTimeBaseMarshaller.as
index 146f3dd00..6f6cdc7c1 100644
--- a/src/as/com/threerings/presents/data/TimeBaseMarshaller_GotTimeBaseMarshaller.as
+++ b/src/as/com/threerings/presents/data/TimeBaseMarshaller_GotTimeBaseMarshaller.as
@@ -29,7 +29,7 @@ import com.threerings.presents.client.TimeBaseService_GotTimeBaseListener;
public class TimeBaseMarshaller_GotTimeBaseMarshaller
extends InvocationMarshaller_ListenerMarshaller
{
- /** The method id used to dispatch {@link #gotTimeOid} responses. */
+ /** The method id used to dispatch gotTimeOid responses. */
public static const GOT_TIME_OID :int = 1;
// from InvocationMarshaller_ListenerMarshaller
diff --git a/src/java/com/threerings/admin/client/DSetEditor.java b/src/java/com/threerings/admin/client/DSetEditor.java
index 129ebc0e9..9523c0db6 100644
--- a/src/java/com/threerings/admin/client/DSetEditor.java
+++ b/src/java/com/threerings/admin/client/DSetEditor.java
@@ -57,7 +57,7 @@ public class DSetEditor extends JPanel
* @param setName The name of the set in the object.
* @param entryClass the Class of the DSet.Entry elements contained in the set.
*/
- public DSetEditor (DObject setter, String setName, Class entryClass)
+ public DSetEditor (DObject setter, String setName, Class> entryClass)
{
this(setter, setName, entryClass, null);
}
@@ -70,7 +70,7 @@ public class DSetEditor extends JPanel
* @param entryClass the Class of the DSet.Entry elements contained in the set.
* @param editableFields the names of the fields in the entryClass that should be editable.
*/
- public DSetEditor (DObject setter, String setName, Class entryClass,
+ public DSetEditor (DObject setter, String setName, Class> entryClass,
String[] editableFields)
{
this(setter, setName, entryClass, editableFields, null);
@@ -85,7 +85,7 @@ public class DSetEditor extends JPanel
* @param editableFields the names of the fields in the entryClass that should be editable.
* @param interp The FieldInterpreter to use.
*/
- public DSetEditor (DObject setter, String setName, Class entryClass,
+ public DSetEditor (DObject setter, String setName, Class> entryClass,
String[] editableFields, ObjectEditorTable.FieldInterpreter interp)
{
super(new BorderLayout());
@@ -147,8 +147,7 @@ public class DSetEditor extends JPanel
{
if (event.getName().equals(_setName)) {
E entry = event.getEntry();
- @SuppressWarnings("unchecked") Comparable key = entry.getKey();
- int index = _keys.insertSorted(key);
+ int index = _keys.insertSorted(getKey(entry));
_table.insertDatum(entry, index);
}
}
@@ -157,7 +156,7 @@ public class DSetEditor extends JPanel
public void entryRemoved (EntryRemovedEvent event)
{
if (event.getName().equals(_setName)) {
- Comparable key = event.getKey();
+ Comparable> key = event.getKey();
int index = _keys.indexOf(key);
_keys.remove(index);
_table.removeDatum(index);
@@ -197,12 +196,17 @@ public class DSetEditor extends JPanel
@SuppressWarnings("unchecked") E[] entries = (E[])new DSet.Entry[_set.size()];
_set.toArray(entries);
for (int ii = 0; ii < entries.length; ii++) {
- @SuppressWarnings("unchecked") Comparable key = entries[ii].getKey();
- _keys.insertSorted(key);
+ _keys.insertSorted(getKey(entries[ii]));
}
_table.setData(entries); // this works because DSet itself is sorted
}
+ @SuppressWarnings("unchecked")
+ protected static Comparable getKey (DSet.Entry entry)
+ {
+ return (Comparable)entry.getKey();
+ }
+
/** The object that contains the set we're displaying. */
protected DObject _setter;
diff --git a/src/java/com/threerings/admin/server/AdminDispatcher.java b/src/java/com/threerings/admin/server/AdminDispatcher.java
index 3db1c5dff..73bd5846e 100644
--- a/src/java/com/threerings/admin/server/AdminDispatcher.java
+++ b/src/java/com/threerings/admin/server/AdminDispatcher.java
@@ -47,7 +47,6 @@ public class AdminDispatcher extends InvocationDispatcher
return new AdminMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/admin/server/ConfigRegistry.java b/src/java/com/threerings/admin/server/ConfigRegistry.java
index 17ba6743b..b425545bd 100644
--- a/src/java/com/threerings/admin/server/ConfigRegistry.java
+++ b/src/java/com/threerings/admin/server/ConfigRegistry.java
@@ -67,7 +67,6 @@ import static com.threerings.admin.Log.log;
*/
public abstract class ConfigRegistry
{
-
/**
* Creates a ConfigRegistry that isn't transitioning.
*/
@@ -138,7 +137,7 @@ public abstract class ConfigRegistry
* Contains all necessary info for a configuration object registration.
*/
protected abstract class ObjectRecord
- implements AttributeChangeListener, SetListener, ElementUpdateListener
+ implements AttributeChangeListener, SetListener, ElementUpdateListener
{
public DObject object;
@@ -150,7 +149,7 @@ public abstract class ConfigRegistry
public void init ()
{
// read in the initial configuration settings from the persistent config repository
- Class cclass = object.getClass();
+ Class> cclass = object.getClass();
try {
Field[] fields = cclass.getFields();
for (int ii = 0; ii < fields.length; ii++) {
@@ -172,19 +171,19 @@ public abstract class ConfigRegistry
}
// from SetListener
- public void entryAdded (EntryAddedEvent event)
+ public void entryAdded (EntryAddedEvent event)
{
serializeAttribute(event.getName());
}
// from SetListener
- public void entryUpdated (EntryUpdatedEvent event)
+ public void entryUpdated (EntryUpdatedEvent event)
{
serializeAttribute(event.getName());
}
// from SetListener
- public void entryRemoved (EntryRemovedEvent event)
+ public void entryRemoved (EntryRemovedEvent event)
{
serializeAttribute(event.getName());
}
@@ -252,7 +251,7 @@ public abstract class ConfigRegistry
protected void initField (Field field)
{
String key = nameToKey(field.getName());
- Class type = field.getType();
+ Class> type = field.getType();
try {
if (type.equals(Boolean.TYPE)) {
diff --git a/src/java/com/threerings/bureau/server/BureauDispatcher.java b/src/java/com/threerings/bureau/server/BureauDispatcher.java
index b568e28f0..2157b592d 100644
--- a/src/java/com/threerings/bureau/server/BureauDispatcher.java
+++ b/src/java/com/threerings/bureau/server/BureauDispatcher.java
@@ -46,7 +46,6 @@ public class BureauDispatcher extends InvocationDispatcher
return new BureauMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/crowd/chat/client/ChatDirector.java b/src/java/com/threerings/crowd/chat/client/ChatDirector.java
index d8103eb84..f77f5a952 100644
--- a/src/java/com/threerings/crowd/chat/client/ChatDirector.java
+++ b/src/java/com/threerings/crowd/chat/client/ChatDirector.java
@@ -80,7 +80,7 @@ public class ChatDirector extends BasicDirector
/**
* Called when the list of chatters has been changed.
*/
- void chattersUpdated (Iterator chatternames);
+ void chattersUpdated (Iterator chatternames);
}
/**
diff --git a/src/java/com/threerings/crowd/chat/server/ChatDispatcher.java b/src/java/com/threerings/crowd/chat/server/ChatDispatcher.java
index 9ab2641ac..bf45d27b1 100644
--- a/src/java/com/threerings/crowd/chat/server/ChatDispatcher.java
+++ b/src/java/com/threerings/crowd/chat/server/ChatDispatcher.java
@@ -49,7 +49,6 @@ public class ChatDispatcher extends InvocationDispatcher
return new ChatMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/crowd/chat/server/SpeakDispatcher.java b/src/java/com/threerings/crowd/chat/server/SpeakDispatcher.java
index 66ecaf489..01640722a 100644
--- a/src/java/com/threerings/crowd/chat/server/SpeakDispatcher.java
+++ b/src/java/com/threerings/crowd/chat/server/SpeakDispatcher.java
@@ -46,7 +46,6 @@ public class SpeakDispatcher extends InvocationDispatcher
return new SpeakMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/crowd/client/OccupantDirector.java b/src/java/com/threerings/crowd/client/OccupantDirector.java
index 870952840..c83b4e7b0 100644
--- a/src/java/com/threerings/crowd/client/OccupantDirector.java
+++ b/src/java/com/threerings/crowd/client/OccupantDirector.java
@@ -57,7 +57,7 @@ import com.threerings.crowd.util.CrowdContext;
* what's in the cache.
*/
public class OccupantDirector extends BasicDirector
- implements LocationObserver, SetListener
+ implements LocationObserver, SetListener
{
/**
* Constructs a new occupant director with the supplied context.
@@ -148,7 +148,7 @@ public class OccupantDirector extends BasicDirector
/**
* Deals with all of the processing when an occupant shows up.
*/
- public void entryAdded (EntryAddedEvent event)
+ public void entryAdded (EntryAddedEvent event)
{
// bail if this isn't for the OCCUPANT_INFO field
if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
@@ -156,7 +156,7 @@ public class OccupantDirector extends BasicDirector
}
// now let the occupant observers know what's up
- final OccupantInfo info = (OccupantInfo)event.getEntry();
+ final OccupantInfo info = event.getEntry();
_observers.apply(new ObserverList.ObserverOp() {
public boolean apply (OccupantObserver observer) {
observer.occupantEntered(info);
@@ -168,7 +168,7 @@ public class OccupantDirector extends BasicDirector
/**
* Deals with all of the processing when an occupant is updated.
*/
- public void entryUpdated (EntryUpdatedEvent event)
+ public void entryUpdated (EntryUpdatedEvent event)
{
// bail if this isn't for the OCCUPANT_INFO field
if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
@@ -176,8 +176,8 @@ public class OccupantDirector extends BasicDirector
}
// now let the occupant observers know what's up
- final OccupantInfo info = (OccupantInfo)event.getEntry();
- final OccupantInfo oinfo = (OccupantInfo)event.getOldEntry();
+ final OccupantInfo info = event.getEntry();
+ final OccupantInfo oinfo = event.getOldEntry();
_observers.apply(new ObserverList.ObserverOp() {
public boolean apply (OccupantObserver observer) {
observer.occupantUpdated(oinfo, info);
@@ -189,7 +189,7 @@ public class OccupantDirector extends BasicDirector
/**
* Deals with all of the processing when an occupant leaves.
*/
- public void entryRemoved (EntryRemovedEvent event)
+ public void entryRemoved (EntryRemovedEvent event)
{
// bail if this isn't for the OCCUPANT_INFO field
if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
@@ -197,7 +197,7 @@ public class OccupantDirector extends BasicDirector
}
// let the occupant observers know what's up
- final OccupantInfo oinfo = (OccupantInfo)event.getOldEntry();
+ final OccupantInfo oinfo = event.getOldEntry();
_observers.apply(new ObserverList.ObserverOp() {
public boolean apply (OccupantObserver observer) {
observer.occupantLeft(oinfo);
@@ -207,8 +207,7 @@ public class OccupantDirector extends BasicDirector
}
/** The occupant observers to keep abreast of occupant antics. */
- protected ObserverList _observers =
- new ObserverList(ObserverList.SAFE_IN_ORDER_NOTIFY);
+ protected ObserverList _observers = ObserverList.newSafeInOrder();
/** The user's current location. */
protected PlaceObject _place;
diff --git a/src/java/com/threerings/crowd/data/OccupantInfo.java b/src/java/com/threerings/crowd/data/OccupantInfo.java
index 7a8938692..1a25cd0b4 100644
--- a/src/java/com/threerings/crowd/data/OccupantInfo.java
+++ b/src/java/com/threerings/crowd/data/OccupantInfo.java
@@ -85,7 +85,7 @@ public class OccupantInfo extends SimpleStreamableObject
}
// documentation inherited
- public Comparable getKey ()
+ public Comparable> getKey ()
{
return bodyOid;
}
diff --git a/src/java/com/threerings/crowd/data/PlaceConfig.java b/src/java/com/threerings/crowd/data/PlaceConfig.java
index 1f36c588c..de32c5ffa 100644
--- a/src/java/com/threerings/crowd/data/PlaceConfig.java
+++ b/src/java/com/threerings/crowd/data/PlaceConfig.java
@@ -52,7 +52,7 @@ public abstract class PlaceConfig extends SimpleStreamableObject
* @deprecated Override {@link #createController} directly.
*/
@Deprecated
- public Class getControllerClass ()
+ public Class> getControllerClass ()
{
return null;
}
@@ -62,7 +62,7 @@ public abstract class PlaceConfig extends SimpleStreamableObject
*/
public PlaceController createController ()
{
- Class cclass = getControllerClass();
+ Class> cclass = getControllerClass();
if (cclass == null) {
throw new RuntimeException(
"PlaceConfig.createController() must be overridden.");
diff --git a/src/java/com/threerings/crowd/data/PlaceObject.java b/src/java/com/threerings/crowd/data/PlaceObject.java
index 738c7013f..683fa1a70 100644
--- a/src/java/com/threerings/crowd/data/PlaceObject.java
+++ b/src/java/com/threerings/crowd/data/PlaceObject.java
@@ -21,8 +21,6 @@
package com.threerings.crowd.data;
-import java.util.Iterator;
-
import com.threerings.util.Name;
import com.threerings.presents.dobj.DObject;
@@ -124,9 +122,7 @@ public class PlaceObject extends DObject
public OccupantInfo getOccupantInfo (Name username)
{
try {
- Iterator iter = occupantInfo.iterator();
- while (iter.hasNext()) {
- OccupantInfo info = (OccupantInfo)iter.next();
+ for (OccupantInfo info : occupantInfo) {
if (info.username.equals(username)) {
return info;
}
@@ -181,7 +177,7 @@ public class PlaceObject extends DObject
* the occupantInfo set. The set will not change until the
* event is actually propagated through the system.
*/
- public void removeFromOccupantInfo (Comparable key)
+ public void removeFromOccupantInfo (Comparable> key)
{
requestEntryRemove(OCCUPANT_INFO, occupantInfo, key);
}
@@ -209,8 +205,7 @@ public class PlaceObject extends DObject
public void setOccupantInfo (DSet value)
{
requestAttributeChange(OCCUPANT_INFO, value, this.occupantInfo);
- @SuppressWarnings("unchecked") DSet clone =
- (value == null) ? null : value.typedClone();
+ DSet clone = (value == null) ? null : value.typedClone();
this.occupantInfo = clone;
}
diff --git a/src/java/com/threerings/crowd/peer/data/CrowdClientInfo.java b/src/java/com/threerings/crowd/peer/data/CrowdClientInfo.java
index 313548a64..a7de4fd5d 100644
--- a/src/java/com/threerings/crowd/peer/data/CrowdClientInfo.java
+++ b/src/java/com/threerings/crowd/peer/data/CrowdClientInfo.java
@@ -34,7 +34,7 @@ public class CrowdClientInfo extends ClientInfo
public Name visibleName;
@Override // documentation inherited
- public Comparable getKey ()
+ public Comparable> getKey ()
{
// the PeerManager works in such a way that we can override our client
// info key and things still work properly; all inter-server
diff --git a/src/java/com/threerings/crowd/peer/server/CrowdPeerDispatcher.java b/src/java/com/threerings/crowd/peer/server/CrowdPeerDispatcher.java
index f95d20efd..347781015 100644
--- a/src/java/com/threerings/crowd/peer/server/CrowdPeerDispatcher.java
+++ b/src/java/com/threerings/crowd/peer/server/CrowdPeerDispatcher.java
@@ -49,7 +49,6 @@ public class CrowdPeerDispatcher extends InvocationDispatcher
return new BodyMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/crowd/server/CrowdObjectAccess.java b/src/java/com/threerings/crowd/server/CrowdObjectAccess.java
index 84ffc0edd..c64842d29 100644
--- a/src/java/com/threerings/crowd/server/CrowdObjectAccess.java
+++ b/src/java/com/threerings/crowd/server/CrowdObjectAccess.java
@@ -43,10 +43,11 @@ public class CrowdObjectAccess
public static AccessController PLACE = new AccessController()
{
// documentation inherited from interface
- public boolean allowSubscribe (DObject object, Subscriber sub)
+ public boolean allowSubscribe (DObject object, Subscriber> sub)
{
- if (sub instanceof CrowdClient) {
- ClientObject co = ((CrowdClient)sub).getClientObject();
+ if (CrowdClient.class.isInstance(sub)) {
+ @SuppressWarnings("unchecked") ClientObject co =
+ ((CrowdClient)sub).getClientObject();
return ((PlaceObject)object).occupants.contains(co.getOid());
}
return true;
diff --git a/src/java/com/threerings/crowd/server/LocationDispatcher.java b/src/java/com/threerings/crowd/server/LocationDispatcher.java
index c42f977be..a13bc1786 100644
--- a/src/java/com/threerings/crowd/server/LocationDispatcher.java
+++ b/src/java/com/threerings/crowd/server/LocationDispatcher.java
@@ -47,7 +47,6 @@ public class LocationDispatcher extends InvocationDispatcher
return new LocationMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/crowd/server/PlaceManager.java b/src/java/com/threerings/crowd/server/PlaceManager.java
index 37859fa96..e4252e246 100644
--- a/src/java/com/threerings/crowd/server/PlaceManager.java
+++ b/src/java/com/threerings/crowd/server/PlaceManager.java
@@ -35,6 +35,7 @@ import com.samskivert.util.StringUtil;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.AccessController;
import com.threerings.presents.dobj.DObject;
+import com.threerings.presents.dobj.DSet;
import com.threerings.presents.dobj.DynamicListener;
import com.threerings.presents.dobj.EntryUpdatedEvent;
import com.threerings.presents.dobj.MessageEvent;
@@ -381,13 +382,13 @@ public class PlaceManager
// Lazily create our dispatcher now that it's actually getting a message
if (_dispatcher == null) {
- Class clazz = getClass();
+ Class> clazz = getClass();
MethodFinder finder = _dispatcherFinders.get(clazz);
if (finder == null) {
finder = new MethodFinder(clazz);
_dispatcherFinders.put(clazz, finder);
}
- _dispatcher = new DynamicListener(this, finder);
+ _dispatcher = new DynamicListener(this, finder);
}
_dispatcher.dispatchMethod(event.getName(), nargs);
}
@@ -707,11 +708,11 @@ public class PlaceManager
}
/** Listens for occupant updates. */
- protected SetAdapter _bodyUpdater = new SetAdapter() {
+ protected SetAdapter _bodyUpdater = new SetAdapter() {
@Override
- public void entryUpdated (EntryUpdatedEvent event) {
+ public void entryUpdated (EntryUpdatedEvent event) {
if (event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
- bodyUpdated((OccupantInfo)event.getEntry());
+ bodyUpdated(event.getEntry());
}
}
};
@@ -748,7 +749,7 @@ public class PlaceManager
protected Interval _shutdownInterval;
/** Used to do method lookup magic when we receive message events. */
- protected DynamicListener _dispatcher;
+ protected DynamicListener> _dispatcher;
/** Maps from a PlaceManager subclass to a MethodFinder for it. When there are many many
* instances of a PlaceManager in existence, having a MethodFinder instance for each gets quite
diff --git a/src/java/com/threerings/io/BasicStreamers.java b/src/java/com/threerings/io/BasicStreamers.java
index 1851ebada..bf0cef4d3 100644
--- a/src/java/com/threerings/io/BasicStreamers.java
+++ b/src/java/com/threerings/io/BasicStreamers.java
@@ -35,7 +35,7 @@ import java.util.RandomAccess;
public class BasicStreamers
{
/** An array of types for all of the basic streamers. */
- public static Class[] BSTREAMER_TYPES = {
+ public static Class>[] BSTREAMER_TYPES = {
Boolean.class,
Byte.class,
Short.class,
@@ -419,7 +419,7 @@ public class BasicStreamers
public void writeObject (Object object, ObjectOutputStream out, boolean useWriter)
throws IOException
{
- writeList(out, (List)object);
+ writeList(out, (List>)object);
}
}
@@ -538,7 +538,7 @@ public class BasicStreamers
return value;
}
- public static ArrayList readList (ObjectInputStream ins)
+ public static ArrayList> readList (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
int ecount = ins.readInt();
@@ -637,7 +637,7 @@ public class BasicStreamers
}
}
- public static void writeList (ObjectOutputStream out, List value)
+ public static void writeList (ObjectOutputStream out, List> value)
throws IOException
{
int ecount = value.size();
diff --git a/src/java/com/threerings/io/ClassMapping.java b/src/java/com/threerings/io/ClassMapping.java
index b3a17f882..047e34134 100644
--- a/src/java/com/threerings/io/ClassMapping.java
+++ b/src/java/com/threerings/io/ClassMapping.java
@@ -28,10 +28,10 @@ package com.threerings.io;
class ClassMapping
{
public short code;
- public Class sclass;
+ public Class> sclass;
public Streamer streamer;
- public ClassMapping (short code, Class sclass, Streamer streamer)
+ public ClassMapping (short code, Class> sclass, Streamer streamer)
{
this.code = code;
this.sclass = sclass;
diff --git a/src/java/com/threerings/io/FieldMarshaller.java b/src/java/com/threerings/io/FieldMarshaller.java
index 2587ba879..b9fdb399f 100644
--- a/src/java/com/threerings/io/FieldMarshaller.java
+++ b/src/java/com/threerings/io/FieldMarshaller.java
@@ -79,7 +79,7 @@ public abstract class FieldMarshaller
}
}
- Class ftype = field.getType();
+ Class> ftype = field.getType();
if (ftype.isInterface()) {
// if the class is a pure interface, use Object.
ftype = Object.class;
@@ -212,7 +212,7 @@ public abstract class FieldMarshaller
protected static void createMarshallers ()
{
// create our table
- _marshallers = new HashMap();
+ _marshallers = new HashMap, FieldMarshaller>();
// create a generic marshaller for streamable instances
FieldMarshaller gmarsh = new FieldMarshaller() {
@@ -354,11 +354,11 @@ public abstract class FieldMarshaller
}
/** Contains a mapping from field type to field marshaller instance for that type. */
- protected static HashMap _marshallers;
+ protected static HashMap, FieldMarshaller> _marshallers;
/** Defines the signature to a custom field reader method. */
- protected static final Class[] READER_ARGS = { ObjectInputStream.class };
+ protected static final Class>[] READER_ARGS = { ObjectInputStream.class };
/** Defines the signature to a custom field writer method. */
- protected static final Class[] WRITER_ARGS = { ObjectOutputStream.class };
+ protected static final Class>[] WRITER_ARGS = { ObjectOutputStream.class };
}
diff --git a/src/java/com/threerings/io/ObjectInputStream.java b/src/java/com/threerings/io/ObjectInputStream.java
index 76f92ae3a..3666f07d9 100644
--- a/src/java/com/threerings/io/ObjectInputStream.java
+++ b/src/java/com/threerings/io/ObjectInputStream.java
@@ -166,7 +166,7 @@ public class ObjectInputStream extends DataInputStream
throws IOException, ClassNotFoundException
{
// resolve the class and streamer
- Class sclass = Class.forName(cname, true, _loader);
+ Class> sclass = Class.forName(cname, true, _loader);
Streamer streamer = Streamer.getStreamer(sclass);
if (STREAM_DEBUG) {
log.info(hashCode() + ": New class '" + cname + "' [code=" + code + "].");
diff --git a/src/java/com/threerings/io/ObjectOutputStream.java b/src/java/com/threerings/io/ObjectOutputStream.java
index 0ea25f2ca..2aa059c03 100644
--- a/src/java/com/threerings/io/ObjectOutputStream.java
+++ b/src/java/com/threerings/io/ObjectOutputStream.java
@@ -25,6 +25,7 @@ import java.io.OutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashMap;
+import java.util.Map;
import static com.threerings.NaryaLog.log;
@@ -71,11 +72,11 @@ public class ObjectOutputStream extends DataOutputStream
// create our classmap if necessary
if (_classmap == null) {
- _classmap = new HashMap();
+ _classmap = new HashMap, ClassMapping>();
}
// otherwise, look up the class mapping record
- Class sclass = Streamer.getStreamerClass(object);
+ Class> sclass = Streamer.getStreamerClass(object);
ClassMapping cmap = _classmap.get(sclass);
// create a class mapping for this class if we've not got one
@@ -108,7 +109,7 @@ public class ObjectOutputStream extends DataOutputStream
/**
* Creates and returns a new class mapping.
*/
- protected ClassMapping createClassMapping (short code, Class sclass, Streamer streamer)
+ protected ClassMapping createClassMapping (short code, Class> sclass, Streamer streamer)
{
return new ClassMapping(code, sclass, streamer);
}
@@ -135,7 +136,7 @@ public class ObjectOutputStream extends DataOutputStream
/**
* Writes out the mapping for a class.
*/
- protected void writeClassMapping (int code, Class sclass)
+ protected void writeClassMapping (int code, Class> sclass)
throws IOException
{
writeShort(code);
@@ -200,7 +201,7 @@ public class ObjectOutputStream extends DataOutputStream
/** Used to map classes to numeric codes and the {@link Streamer} instance used to write
* them. */
- protected HashMap _classmap;
+ protected Map, ClassMapping> _classmap;
/** A counter used to assign codes to streamed classes. */
protected short _nextCode = 1;
@@ -212,5 +213,5 @@ public class ObjectOutputStream extends DataOutputStream
protected Streamer _streamer;
/** An optional set of class name translations to use when serializing objects. */
- protected HashMap _translations;
+ protected Map _translations;
}
diff --git a/src/java/com/threerings/io/Streamer.java b/src/java/com/threerings/io/Streamer.java
index c31ab8eab..a84c539d5 100644
--- a/src/java/com/threerings/io/Streamer.java
+++ b/src/java/com/threerings/io/Streamer.java
@@ -34,6 +34,7 @@ import java.security.PrivilegedActionException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import com.google.common.collect.Lists;
@@ -54,7 +55,7 @@ public class Streamer
/**
* Returns true if the supplied target class can be streamed using a streamer.
*/
- public synchronized static boolean isStreamable (Class target)
+ public synchronized static boolean isStreamable (Class> target)
{
while (true) {
// if we've got a streamer for it, it's good
@@ -82,10 +83,10 @@ public class Streamer
* object's natural class, but for enum values, that might be its declaring class as enums use
* classes in a way that would otherwise pollute our id to class mapping space.
*/
- public static Class getStreamerClass (Object object)
+ public static Class> getStreamerClass (Object object)
{
return (object instanceof Enum) ?
- ((Enum)object).getDeclaringClass() : object.getClass();
+ ((Enum>)object).getDeclaringClass() : object.getClass();
}
/**
@@ -100,7 +101,7 @@ public class Streamer
* {@link Streamable} and is not one of the basic object types (@see {@link
* ObjectOutputStream}).
*/
- public synchronized static Streamer getStreamer (final Class target)
+ public synchronized static Streamer getStreamer (final Class> target)
throws IOException
{
// if we have not yet initialized ourselves, do so now
@@ -211,7 +212,7 @@ public class Streamer
// if someone serializes an enum to a file and then adds a value to the enum, changing the
// ordinal assignments)
if (_target.isEnum()) {
- out.writeUTF(((Enum)object).name());
+ out.writeUTF(((Enum>)object).name());
return;
}
@@ -262,8 +263,9 @@ public class Streamer
if (ObjectInputStream.STREAM_DEBUG) {
log.info(in.hashCode() + ": Creating enum '" + _target.getName() + "'.");
}
- @SuppressWarnings("unchecked") Object value = Enum.valueOf(_target, in.readUTF());
- return value;
+ @SuppressWarnings("unchecked") Class eclass =
+ (Class)_target;
+ return Enum.valueOf(eclass, in.readUTF());
} else {
if (ObjectInputStream.STREAM_DEBUG) {
@@ -482,7 +484,7 @@ public class Streamer
*/
protected static void createStreamers ()
{
- _streamers = new HashMap();
+ _streamers = new HashMap, Streamer>();
// register all of the basic streamers
int bscount = BasicStreamers.BSTREAMER_TYPES.length;
@@ -491,9 +493,12 @@ public class Streamer
BasicStreamers.BSTREAMER_INSTANCES[ii]);
}
}
+
+ /** Used to coerce the type system into quietude when reading enums from the wire. */
+ protected static enum EnumReader { NOT_USED };
/** The class for which this streamer instance is configured. */
- protected Class _target;
+ protected Class> _target;
/** If our target class is an array, this is a reference to a streamer that can stream our
* array elements, otherwise it is null. */
@@ -513,7 +518,7 @@ public class Streamer
protected Method _writer;
/** Contains the mapping from class names to configured streamer instances. */
- protected static HashMap _streamers;
+ protected static Map, Streamer> _streamers;
/** A simple predicate to filter "NotStreamable" members from a Streamable object's fields. */
protected static final Predicate _isStreamableFieldPred = new Predicate() {
@@ -526,11 +531,11 @@ public class Streamer
protected static final String READER_METHOD_NAME = "readObject";
/** The argument list for the custom reader method. */
- protected static final Class[] READER_ARGS = { ObjectInputStream.class };
+ protected static final Class>[] READER_ARGS = { ObjectInputStream.class };
/** The name of the custom writer method. */
protected static final String WRITER_METHOD_NAME = "writeObject";
/** The argument list for the custom writer method. */
- protected static final Class[] WRITER_ARGS = { ObjectOutputStream.class };
+ protected static final Class>[] WRITER_ARGS = { ObjectOutputStream.class };
}
diff --git a/src/java/com/threerings/io/UnreliableObjectOutputStream.java b/src/java/com/threerings/io/UnreliableObjectOutputStream.java
index 647f92b51..250809ee5 100644
--- a/src/java/com/threerings/io/UnreliableObjectOutputStream.java
+++ b/src/java/com/threerings/io/UnreliableObjectOutputStream.java
@@ -29,7 +29,7 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
* Sets the reference to the set that will hold the classes for which mappings have been
* written.
*/
- public void setMappedClasses (Set mappedClasses)
+ public void setMappedClasses (Set> mappedClasses)
{
_mappedClasses = mappedClasses;
}
@@ -37,7 +37,7 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
/**
* Returns a reference to the set of classes for which mappings have been written.
*/
- public Set getMappedClasses ()
+ public Set> getMappedClasses ()
{
return _mappedClasses;
}
@@ -46,7 +46,7 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
* Notes that the receiver has received the mappings for a group of classes, and thus that from
* now on, only the class codes need be sent.
*/
- public void noteMappingsReceived (Collection sclasses)
+ public void noteMappingsReceived (Collection> sclasses)
{
// sanity check
if (_classmap == null) {
@@ -54,7 +54,7 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
}
// make each class's code positive to signify that we no longer need to send metadata
- for (Class sclass : sclasses) {
+ for (Class> sclass : sclasses) {
ClassMapping cmap = _classmap.get(sclass);
if (cmap == null) {
throw new RuntimeException("No class mapping for " + sclass.getName());
@@ -64,7 +64,7 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
}
@Override // documentation inherited
- protected ClassMapping createClassMapping (short code, Class sclass, Streamer streamer)
+ protected ClassMapping createClassMapping (short code, Class> sclass, Streamer streamer)
{
// the negative class code indicates that we must rewrite the metadata for the first
// instance in each go-round; when we are notified that the other side has cached the
@@ -98,7 +98,7 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
}
@Override // documentation inherited
- protected void writeClassMapping (int code, Class sclass)
+ protected void writeClassMapping (int code, Class> sclass)
throws IOException
{
super.writeClassMapping(code, sclass);
@@ -108,5 +108,5 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
}
/** The set of classes for which we have written mappings. */
- protected Set _mappedClasses = new HashSet();
+ protected Set> _mappedClasses = new HashSet>();
}
diff --git a/src/java/com/threerings/presents/client/Client.java b/src/java/com/threerings/presents/client/Client.java
index 74a70c72e..a9c618f21 100644
--- a/src/java/com/threerings/presents/client/Client.java
+++ b/src/java/com/threerings/presents/client/Client.java
@@ -252,7 +252,7 @@ public class Client
* matches. Note also: this method cannot be called until after the client has
* established a connection with the server and the distributed object manager is available.
*/
- public void registerFlushDelay (Class objclass, long delay)
+ public void registerFlushDelay (Class> objclass, long delay)
{
ClientDObjectMgr omgr = (ClientDObjectMgr)getDObjectManager();
omgr.registerFlushDelay(objclass, delay);
diff --git a/src/java/com/threerings/presents/client/ClientDObjectMgr.java b/src/java/com/threerings/presents/client/ClientDObjectMgr.java
index db13c27f4..1cf49f549 100644
--- a/src/java/com/threerings/presents/client/ClientDObjectMgr.java
+++ b/src/java/com/threerings/presents/client/ClientDObjectMgr.java
@@ -401,7 +401,7 @@ public class ClientDObjectMgr
* This is guaranteed to be invoked via the invoker and can safely do main thread type things
* like call back to the subscriber.
*/
- protected void doUnsubscribe (int oid, Subscriber target)
+ protected void doUnsubscribe (int oid, Subscriber> target)
{
DObject dobj = _ocache.get(oid);
if (dobj != null) {
diff --git a/src/java/com/threerings/presents/client/InvocationReceiver.java b/src/java/com/threerings/presents/client/InvocationReceiver.java
index f44eb13e9..e9177616c 100644
--- a/src/java/com/threerings/presents/client/InvocationReceiver.java
+++ b/src/java/com/threerings/presents/client/InvocationReceiver.java
@@ -74,7 +74,7 @@ public interface InvocationReceiver
}
// documentation inherited from interface
- public Comparable getKey ()
+ public Comparable> getKey ()
{
return receiverCode;
}
diff --git a/src/java/com/threerings/presents/data/ClientObject.java b/src/java/com/threerings/presents/data/ClientObject.java
index a8d3dc675..0782c99fe 100644
--- a/src/java/com/threerings/presents/data/ClientObject.java
+++ b/src/java/com/threerings/presents/data/ClientObject.java
@@ -139,7 +139,7 @@ public class ClientObject extends DObject
* the receivers set. The set will not change until the
* event is actually propagated through the system.
*/
- public void removeFromReceivers (Comparable key)
+ public void removeFromReceivers (Comparable> key)
{
requestEntryRemove(RECEIVERS, receivers, key);
}
@@ -167,8 +167,7 @@ public class ClientObject extends DObject
public void setReceivers (DSet value)
{
requestAttributeChange(RECEIVERS, value, this.receivers);
- @SuppressWarnings("unchecked") DSet clone =
- (value == null) ? null : value.typedClone();
+ DSet clone = (value == null) ? null : value.typedClone();
this.receivers = clone;
}
// AUTO-GENERATED: METHODS END
diff --git a/src/java/com/threerings/presents/dobj/AccessController.java b/src/java/com/threerings/presents/dobj/AccessController.java
index a2ac6aa59..7b144cab0 100644
--- a/src/java/com/threerings/presents/dobj/AccessController.java
+++ b/src/java/com/threerings/presents/dobj/AccessController.java
@@ -33,7 +33,7 @@ public interface AccessController
* Should return true if the supplied subscriber is allowed to
* subscribe to the specified object.
*/
- boolean allowSubscribe (DObject object, Subscriber subscriber);
+ boolean allowSubscribe (DObject object, Subscriber> subscriber);
/**
* Should return true if the supplied event is legal for dispatch on
diff --git a/src/java/com/threerings/presents/dobj/AttributeChangedEvent.java b/src/java/com/threerings/presents/dobj/AttributeChangedEvent.java
index 5012a7a65..7af671028 100644
--- a/src/java/com/threerings/presents/dobj/AttributeChangedEvent.java
+++ b/src/java/com/threerings/presents/dobj/AttributeChangedEvent.java
@@ -131,7 +131,7 @@ public class AttributeChangedEvent extends NamedEvent
_oldValue = target.getAttribute(_name);
Object value = _value;
if (value != null) {
- Class vclass = value.getClass();
+ Class> vclass = value.getClass();
if (vclass.isPrimitive()) {
// do nothing; we check this to avoid the more expensive isAssignableFrom check
// on primitives which are far and away the most common case
@@ -141,7 +141,7 @@ public class AttributeChangedEvent extends NamedEvent
System.arraycopy(value, 0, clone, 0, length);
value = clone;
} else if (DSet.class.isAssignableFrom(vclass)) {
- value = ((DSet)value).clone();
+ value = ((DSet>)value).clone();
}
}
// pass the new value on to the object
diff --git a/src/java/com/threerings/presents/dobj/DEvent.java b/src/java/com/threerings/presents/dobj/DEvent.java
index 5cb47ff81..29b757673 100644
--- a/src/java/com/threerings/presents/dobj/DEvent.java
+++ b/src/java/com/threerings/presents/dobj/DEvent.java
@@ -202,7 +202,7 @@ public abstract class DEvent implements Streamable
/** Used to differentiate between null meaning we haven't initialized our old entry and null
* being the actual old entry. */
protected static final DSet.Entry UNSET_OLD_ENTRY = new DSet.Entry() {
- public Comparable getKey () {
+ public Comparable> getKey () {
return null;
}
};
diff --git a/src/java/com/threerings/presents/dobj/DObject.java b/src/java/com/threerings/presents/dobj/DObject.java
index 692d029e9..fce4b4132 100644
--- a/src/java/com/threerings/presents/dobj/DObject.java
+++ b/src/java/com/threerings/presents/dobj/DObject.java
@@ -25,7 +25,9 @@ import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Comparator;
-import java.util.HashMap;
+import java.util.Map;
+
+import com.google.common.collect.Maps;
import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
@@ -151,7 +153,7 @@ public class DObject
*
* @see DObjectManager#subscribeToObject
*/
- public void addSubscriber (Subscriber sub)
+ public void addSubscriber (Subscriber> sub)
{
// only add the subscriber if they're not already there
Object[] subs = ListUtil.testAndAddRef(_subs, sub);
@@ -175,7 +177,7 @@ public class DObject
*
* @see DObjectManager#unsubscribeFromObject
*/
- public void removeSubscriber (Subscriber sub)
+ public void removeSubscriber (Subscriber> sub)
{
if (ListUtil.clearRef(_subs, sub) != null) {
// if we removed something, check to see if we just removed the last subscriber from
@@ -291,7 +293,7 @@ public class DObject
/**
* Request to have the specified key removed from the specified DSet.
*/
- public void removeFromSet (String setName, Comparable key)
+ public void removeFromSet (String setName, Comparable> key)
{
requestEntryRemove(setName, getSet(setName), key);
}
@@ -377,7 +379,7 @@ public class DObject
*
* @return true if the subscriber has access to the object, false if they do not.
*/
- public boolean checkPermissions (Subscriber sub)
+ public boolean checkPermissions (Subscriber> sub)
{
if (_controller != null) {
return _controller.allowSubscribe(this, sub);
@@ -814,7 +816,7 @@ public class DObject
* Calls by derived instances when a set remover method was called.
*/
protected void requestEntryRemove (
- String name, DSet set, Comparable key)
+ String name, DSet set, Comparable> key)
{
// if we're on the authoritative server, we update the set immediately
T oldEntry = null;
@@ -913,7 +915,7 @@ public class DObject
protected transient boolean _deathWish = false;
/** Maintains a mapping of sorted field arrays for each distributed object class. */
- protected static HashMap _ftable = new HashMap();
+ protected static Map, Field[]> _ftable = Maps.newHashMap();
/** Used to sort and search {@link #_fields}. */
protected static final Comparator FIELD_COMP = new Comparator() {
diff --git a/src/java/com/threerings/presents/dobj/DSet.java b/src/java/com/threerings/presents/dobj/DSet.java
index b6b9bb17f..79ec74493 100644
--- a/src/java/com/threerings/presents/dobj/DSet.java
+++ b/src/java/com/threerings/presents/dobj/DSet.java
@@ -63,7 +63,7 @@ public class DSet
* Each entry provide an associated key which is used to determine its uniqueness in the
* set. See the {@link DSet} class documentation for further information.
*/
- Comparable getKey ();
+ Comparable> getKey ();
}
/**
@@ -82,6 +82,17 @@ public class DSet
return new DSet(source);
}
+ /**
+ * Compares the first comparable to the second. This is useful to avoid type safety warnings
+ * when dealing with the keys of {@link DSet.Entry} values.
+ */
+ public static int compare (Comparable> c1, Comparable> c2)
+ {
+ @SuppressWarnings("unchecked") Comparable cc1 = (Comparable)c1;
+ @SuppressWarnings("unchecked") Comparable cc2 = (Comparable)c2;
+ return cc1.compareTo(cc2);
+ }
+
/**
* Creates a distributed set and populates it with values from the supplied iterator. This
* should be done before the set is unleashed into the wild distributed object world because no
@@ -161,7 +172,7 @@ public class DSet
* Returns true if an entry in the set has a key that equals() the supplied
* key. Returns false otherwise.
*/
- public boolean containsKey (Comparable key)
+ public boolean containsKey (Comparable> key)
{
return get(key) != null;
}
@@ -170,7 +181,7 @@ public class DSet
* Returns the entry that matches (getKey().equals(key)) the specified key or null
* if no entry could be found that matches the key.
*/
- public E get (Comparable key)
+ public E get (Comparable> key)
{
// determine where we'll be adding the new element
int eidx = ArrayUtil.binarySearch(_entries, 0, _size, new KeyWrapper(key), ENTRY_COMP);
@@ -325,7 +336,7 @@ public class DSet
*
* @return the old matching entry if found and removed, null if not found.
*/
- protected E removeKey (Comparable key)
+ protected E removeKey (Comparable> key)
{
// don't fail, but generate a warning if we're passed a null key
if (key == null) {
@@ -461,13 +472,13 @@ public class DSet
/** Used to search for keys. */
protected static class KeyWrapper implements DSet.Entry
{
- public KeyWrapper (Comparable key) {
+ public KeyWrapper (Comparable> key) {
_key = key;
}
- public Comparable getKey () {
+ public Comparable> getKey () {
return _key;
}
- protected Comparable _key;
+ protected Comparable> _key;
}
/** The entries of the set (in a sparse array). */
@@ -485,8 +496,7 @@ public class DSet
/** Used for lookups and to keep the set contents sorted on insertions. */
protected static Comparator ENTRY_COMP = new Comparator() {
public int compare (Entry e1, Entry e2) {
- @SuppressWarnings("unchecked") int val = e1.getKey().compareTo(e2.getKey());
- return val;
+ return DSet.compare(e1.getKey(), e2.getKey());
}
};
}
diff --git a/src/java/com/threerings/presents/dobj/DynamicListener.java b/src/java/com/threerings/presents/dobj/DynamicListener.java
index b73c38ab6..5b821e47e 100644
--- a/src/java/com/threerings/presents/dobj/DynamicListener.java
+++ b/src/java/com/threerings/presents/dobj/DynamicListener.java
@@ -33,8 +33,8 @@ import static com.threerings.presents.Log.log;
/**
* Maps distributed object events to methods using reflection.
*/
-public class DynamicListener
- implements AttributeChangeListener, ElementUpdateListener, SetListener
+public class DynamicListener
+ implements AttributeChangeListener, ElementUpdateListener, SetListener
{
/**
* Creates a listener that dynamically dispatches events on the supplied
@@ -70,21 +70,21 @@ public class DynamicListener
}
// from interface SetListener
- public void entryAdded (EntryAddedEvent event)
+ public void entryAdded (EntryAddedEvent event)
{
dispatchMethod(event.getName() + "Added",
new Object[] { event.getEntry() });
}
// from interface SetListener
- public void entryUpdated (EntryUpdatedEvent event)
+ public void entryUpdated (EntryUpdatedEvent event)
{
dispatchMethod(event.getName() + "Updated",
new Object[] { event.getEntry() });
}
// from interface SetListener
- public void entryRemoved (EntryRemovedEvent event)
+ public void entryRemoved (EntryRemovedEvent event)
{
dispatchMethod(event.getName() + "Removed",
new Object[] { event.getKey() });
@@ -120,7 +120,7 @@ public class DynamicListener
*/
protected Method resolveMethod (String name, Object[] arguments)
{
- Class[] ptypes = new Class[arguments.length];
+ Class>[] ptypes = new Class>[arguments.length];
for (int ii = 0; ii < arguments.length; ii++) {
ptypes[ii] = arguments[ii] == null ?
null : arguments[ii].getClass();
diff --git a/src/java/com/threerings/presents/dobj/ElementUpdatedEvent.java b/src/java/com/threerings/presents/dobj/ElementUpdatedEvent.java
index a4ce5302d..4df64f14f 100644
--- a/src/java/com/threerings/presents/dobj/ElementUpdatedEvent.java
+++ b/src/java/com/threerings/presents/dobj/ElementUpdatedEvent.java
@@ -167,7 +167,7 @@ public class ElementUpdatedEvent extends NamedEvent
try {
// fetch the array field from the object
Field field = target.getClass().getField(_name);
- Class ftype = field.getType();
+ Class> ftype = field.getType();
// sanity check
if (!ftype.isArray()) {
diff --git a/src/java/com/threerings/presents/dobj/EntryRemovedEvent.java b/src/java/com/threerings/presents/dobj/EntryRemovedEvent.java
index 2932f9beb..3b20462a9 100644
--- a/src/java/com/threerings/presents/dobj/EntryRemovedEvent.java
+++ b/src/java/com/threerings/presents/dobj/EntryRemovedEvent.java
@@ -44,7 +44,7 @@ public class EntryRemovedEvent extends NamedEvent
* @param key the entry key that identifies the entry to remove.
* @param oldEntry the previous value of the entry.
*/
- public EntryRemovedEvent (int targetOid, String name, Comparable key, T oldEntry)
+ public EntryRemovedEvent (int targetOid, String name, Comparable> key, T oldEntry)
{
super(targetOid, name);
_key = key;
@@ -62,7 +62,7 @@ public class EntryRemovedEvent extends NamedEvent
/**
* Returns the key that identifies the entry that has been removed.
*/
- public Comparable getKey ()
+ public Comparable> getKey ()
{
return _key;
}
@@ -115,7 +115,7 @@ public class EntryRemovedEvent extends NamedEvent
buf.append(", key=").append(_key);
}
- protected Comparable _key;
+ protected Comparable> _key;
@SuppressWarnings("unchecked")
protected transient T _oldEntry = (T)UNSET_OLD_ENTRY;
diff --git a/src/java/com/threerings/presents/peer/data/ClientInfo.java b/src/java/com/threerings/presents/peer/data/ClientInfo.java
index cbb2be1a2..0986184b2 100644
--- a/src/java/com/threerings/presents/peer/data/ClientInfo.java
+++ b/src/java/com/threerings/presents/peer/data/ClientInfo.java
@@ -36,7 +36,7 @@ public class ClientInfo extends SimpleStreamableObject
public Name username;
// documentation inherited from interface DSet.Entry
- public Comparable getKey ()
+ public Comparable> getKey ()
{
return username;
}
diff --git a/src/java/com/threerings/presents/peer/data/NodeObject.java b/src/java/com/threerings/presents/peer/data/NodeObject.java
index 1624160be..abc07acf7 100644
--- a/src/java/com/threerings/presents/peer/data/NodeObject.java
+++ b/src/java/com/threerings/presents/peer/data/NodeObject.java
@@ -65,13 +65,13 @@ public class NodeObject extends DObject
public String type;
/** The resource identifier, which can be null for singleton resources. */
- public Comparable id;
+ public Comparable> id;
public Lock ()
{
}
- public Lock (String type, Comparable id)
+ public Lock (String type, Comparable> id)
{
this.type = type;
this.id = id;
@@ -84,12 +84,11 @@ public class NodeObject extends DObject
if (v1 != 0 || id == null) {
return v1;
}
- @SuppressWarnings("unchecked") int v2 = id.compareTo(olock.id);
- return v2;
+ return DSet.compare(id, olock.id);
}
// documentation inherited from interface DSet.Entry
- public Comparable getKey ()
+ public Comparable> getKey ()
{
return this;
}
@@ -197,7 +196,7 @@ public class NodeObject extends DObject
* the clients set. The set will not change until the
* event is actually propagated through the system.
*/
- public void removeFromClients (Comparable key)
+ public void removeFromClients (Comparable> key)
{
requestEntryRemove(CLIENTS, clients, key);
}
@@ -225,8 +224,7 @@ public class NodeObject extends DObject
public void setClients (DSet value)
{
requestAttributeChange(CLIENTS, value, this.clients);
- @SuppressWarnings("unchecked") DSet clone =
- (value == null) ? null : value.typedClone();
+ DSet clone = (value == null) ? null : value.typedClone();
this.clients = clone;
}
@@ -245,7 +243,7 @@ public class NodeObject extends DObject
* the locks set. The set will not change until the
* event is actually propagated through the system.
*/
- public void removeFromLocks (Comparable key)
+ public void removeFromLocks (Comparable> key)
{
requestEntryRemove(LOCKS, locks, key);
}
@@ -273,8 +271,7 @@ public class NodeObject extends DObject
public void setLocks (DSet value)
{
requestAttributeChange(LOCKS, value, this.locks);
- @SuppressWarnings("unchecked") DSet clone =
- (value == null) ? null : value.typedClone();
+ DSet clone = (value == null) ? null : value.typedClone();
this.locks = clone;
}
diff --git a/src/java/com/threerings/presents/peer/server/PeerDispatcher.java b/src/java/com/threerings/presents/peer/server/PeerDispatcher.java
index 8e008f25e..7a081df0f 100644
--- a/src/java/com/threerings/presents/peer/server/PeerDispatcher.java
+++ b/src/java/com/threerings/presents/peer/server/PeerDispatcher.java
@@ -47,7 +47,6 @@ public class PeerDispatcher extends InvocationDispatcher
return new PeerMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/presents/peer/server/PeerManager.java b/src/java/com/threerings/presents/peer/server/PeerManager.java
index 52e8ba0b3..bc04b7dd2 100644
--- a/src/java/com/threerings/presents/peer/server/PeerManager.java
+++ b/src/java/com/threerings/presents/peer/server/PeerManager.java
@@ -989,7 +989,7 @@ public abstract class PeerManager
* Handles a lock in a state of resolution.
*/
protected class LockHandler
- implements SetListener
+ implements SetListener
{
/** Listeners waiting for resolution. */
public ResultListenerList listeners = new ResultListenerList();
@@ -1116,7 +1116,7 @@ public abstract class PeerManager
}
// documentation inherited from interface SetListener
- public void entryAdded (EntryAddedEvent event)
+ public void entryAdded (EntryAddedEvent event)
{
if (_acquire && event.getName().equals(NodeObject.LOCKS) &&
event.getEntry().equals(_lock)) {
@@ -1125,7 +1125,7 @@ public abstract class PeerManager
}
// documentation inherited from interface SetListener
- public void entryRemoved (EntryRemovedEvent event)
+ public void entryRemoved (EntryRemovedEvent event)
{
if (!_acquire && event.getName().equals(NodeObject.LOCKS) &&
event.getOldEntry().equals(_lock)) {
@@ -1134,7 +1134,7 @@ public abstract class PeerManager
}
// documentation inherited from interface SetListener
- public void entryUpdated (EntryUpdatedEvent event)
+ public void entryUpdated (EntryUpdatedEvent event)
{
if (!_acquire && event.getName().equals(NodeObject.LOCKS) &&
event.getEntry().equals(_lock)) {
diff --git a/src/java/com/threerings/presents/peer/util/PeerUtil.java b/src/java/com/threerings/presents/peer/util/PeerUtil.java
index 5a927f114..3649beed8 100644
--- a/src/java/com/threerings/presents/peer/util/PeerUtil.java
+++ b/src/java/com/threerings/presents/peer/util/PeerUtil.java
@@ -52,13 +52,13 @@ public class PeerUtil
S createProviderProxy (Class clazz, final T svc, final Client client)
{
return clazz.cast(Proxy.newProxyInstance(
- clazz.getClassLoader(), new Class[] { clazz },
+ clazz.getClassLoader(), new Class>[] { clazz },
new InvocationHandler() {
public Object invoke (Object proxy, Method method, Object[] args)
throws Throwable {
Method smethod = _pmethods.get(method);
if (smethod == null) {
- Class[] ptypes = method.getParameterTypes();
+ Class>[] ptypes = method.getParameterTypes();
ptypes[0] = Client.class;
_pmethods.put(method, smethod = svc.getClass().getMethod(
method.getName(), ptypes));
diff --git a/src/java/com/threerings/presents/server/InvocationManager.java b/src/java/com/threerings/presents/server/InvocationManager.java
index 3de6b874d..cc84d79fd 100644
--- a/src/java/com/threerings/presents/server/InvocationManager.java
+++ b/src/java/com/threerings/presents/server/InvocationManager.java
@@ -196,7 +196,7 @@ public class InvocationManager
* @return the Class, or null if no dispatcher is registered with
* the specified code.
*/
- public Class getDispatcherClass (int invCode)
+ public Class> getDispatcherClass (int invCode)
{
Object dispatcher = _dispatchers.get(invCode);
return (dispatcher == null) ? null : dispatcher.getClass();
@@ -233,7 +233,7 @@ public class InvocationManager
}
// look up the dispatcher
- InvocationDispatcher disp = _dispatchers.get(invCode);
+ InvocationDispatcher> disp = _dispatchers.get(invCode);
if (disp == null) {
log.info("Received invocation request but dispatcher " +
"registration was already cleared [code=" + invCode +
@@ -317,7 +317,7 @@ public class InvocationManager
protected PresentsDObjectMgr _omgr;
/** A table of invocation dispatchers each mapped by a unique code. */
- protected IntMap _dispatchers = IntMaps.newHashIntMap();
+ protected IntMap> _dispatchers = IntMaps.newHashIntMap();
/** Maps bootstrap group to lists of services to be provided to clients at boot time. */
protected Map> _bootlists = Maps.newHashMap();
diff --git a/src/java/com/threerings/presents/server/PresentsClient.java b/src/java/com/threerings/presents/server/PresentsClient.java
index 756d1dde5..cfd2ddec4 100644
--- a/src/java/com/threerings/presents/server/PresentsClient.java
+++ b/src/java/com/threerings/presents/server/PresentsClient.java
@@ -90,7 +90,7 @@ public class PresentsClient
*
* @param rl when this method is finished with its business and the old client object can
* be destroyed, the result listener should be called. */
- void changeReported (ClientObject newObji, ResultListener rl);
+ void changeReported (ClientObject newObji, ResultListener rl);
/** Called when the user change is completed, the old client object is destroyed and all
* updates are committed. */
@@ -210,8 +210,8 @@ public class PresentsClient
// let the caller know that we've got some new business
if (ucl != null) {
- ucl.changeReported(clobj, new ResultListener() {
- public void requestCompleted (Object result) {
+ ucl.changeReported(clobj, new ResultListener() {
+ public void requestCompleted (Void result) {
finishResolved(username, clobj);
}
public void requestFailed (Exception cause) {
diff --git a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java
index 90234c689..3e8439acf 100644
--- a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java
+++ b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java
@@ -402,7 +402,7 @@ public class PresentsDObjectMgr
// if this object has any oid list fields that are still referencing other objects, we need
// to clear out those references
- Class oclass = target.getClass();
+ Class> oclass = target.getClass();
Field[] fields = oclass.getFields();
for (int f = 0; f < fields.length; f++) {
Field field = fields[f];
@@ -626,7 +626,7 @@ public class PresentsDObjectMgr
cname = StringUtil.shortClassName(ival);
} else if (unit instanceof InvocationRequestEvent) {
InvocationRequestEvent ire = (InvocationRequestEvent)unit;
- Class c = _invmgr.getDispatcherClass(ire.getInvCode());
+ Class> c = _invmgr.getDispatcherClass(ire.getInvCode());
cname = (c == null) ? "dobj.InvocationRequestEvent:(no longer registered)" :
StringUtil.shortClassName(c) + ":" + ire.getMethodId();
} else {
@@ -645,7 +645,7 @@ public class PresentsDObjectMgr
*/
protected void processCompoundEvent (CompoundEvent event)
{
- List events = event.getEvents();
+ List events = event.getEvents();
int ecount = events.size();
// look up the target object
@@ -657,7 +657,7 @@ public class PresentsDObjectMgr
// check the permissions on all of the events
for (int ii = 0; ii < ecount; ii++) {
- DEvent sevent = (DEvent)events.get(ii);
+ DEvent sevent = events.get(ii);
if (!target.checkPermissions(sevent)) {
log.warning("Event failed permissions check [event=" + sevent +
", target=" + target + "].");
@@ -667,7 +667,7 @@ public class PresentsDObjectMgr
// dispatch the events
for (int ii = 0; ii < ecount; ii++) {
- dispatchEvent((DEvent)events.get(ii), target);
+ dispatchEvent(events.get(ii), target);
}
// always notify proxies of compound events
@@ -810,7 +810,7 @@ public class PresentsDObjectMgr
*/
protected void registerEventHelpers ()
{
- Class[] ptypes = new Class[] { DEvent.class, DObject.class };
+ Class>[] ptypes = new Class>[] { DEvent.class, DObject.class };
Method method;
try {
@@ -1030,7 +1030,7 @@ public class PresentsDObjectMgr
protected Stats _recent = new Stats(), _current = _recent;
/** Maps event classes to helpers that perform additional processing for particular events. */
- protected Map _helpers = Maps.newHashMap();
+ protected Map, Method> _helpers = Maps.newHashMap();
/** Used to resolve unit names when profiling. Injected by the invmgr when it's created. */
protected InvocationManager _invmgr;
diff --git a/src/java/com/threerings/presents/server/PresentsInvoker.java b/src/java/com/threerings/presents/server/PresentsInvoker.java
index 0d2a4c7e5..5e6c97277 100644
--- a/src/java/com/threerings/presents/server/PresentsInvoker.java
+++ b/src/java/com/threerings/presents/server/PresentsInvoker.java
@@ -78,7 +78,7 @@ public class PresentsInvoker extends Invoker
for (Object key : _tracker.keySet()) {
UnitProfile profile = _tracker.get(key);
if (key instanceof Class) {
- key = StringUtil.shortClassName((Class)key);
+ key = StringUtil.shortClassName((Class>)key);
}
buf.append(" ").append(key).append(" ");
buf.append(profile).append("\n");
diff --git a/src/java/com/threerings/presents/server/PresentsObjectAccess.java b/src/java/com/threerings/presents/server/PresentsObjectAccess.java
index 42a4f4c18..45d833b45 100644
--- a/src/java/com/threerings/presents/server/PresentsObjectAccess.java
+++ b/src/java/com/threerings/presents/server/PresentsObjectAccess.java
@@ -44,7 +44,7 @@ public class PresentsObjectAccess
public static AccessController DEFAULT = new AccessController()
{
// documentation inherited from interface
- public boolean allowSubscribe (DObject object, Subscriber subscriber)
+ public boolean allowSubscribe (DObject object, Subscriber> subscriber)
{
// allow anyone to subscribe
return true;
@@ -70,12 +70,13 @@ public class PresentsObjectAccess
public static AccessController CLIENT = new AccessController()
{
// documentation inherited from interface
- public boolean allowSubscribe (DObject object, Subscriber sub)
+ public boolean allowSubscribe (DObject object, Subscriber> sub)
{
boolean allowed = true;
// if the subscriber is a client, ensure that they are this same user
- if (sub instanceof PresentsClient) {
- allowed = ((PresentsClient)sub).getClientObject() == object;
+ if (PresentsClient.class.isInstance(sub)) {
+ @SuppressWarnings("unchecked") PresentsClient client = (PresentsClient)sub;
+ allowed = (client.getClientObject() == object);
if (!allowed) {
log.warning("Refusing ClientObject subscription request " +
"[obj=" + ((ClientObject)object).who() + ", sub=" + sub + "].");
diff --git a/src/java/com/threerings/presents/server/PresentsServer.java b/src/java/com/threerings/presents/server/PresentsServer.java
index ed877929e..c80040246 100644
--- a/src/java/com/threerings/presents/server/PresentsServer.java
+++ b/src/java/com/threerings/presents/server/PresentsServer.java
@@ -81,7 +81,7 @@ public class PresentsServer
if (testmod != null) {
try {
log.info("Invoking test module [mod=" + testmod + "].");
- Class tmclass = Class.forName(testmod);
+ Class> tmclass = Class.forName(testmod);
Runnable trun = (Runnable)tmclass.newInstance();
trun.run();
} catch (Exception e) {
diff --git a/src/java/com/threerings/presents/server/TimeBaseDispatcher.java b/src/java/com/threerings/presents/server/TimeBaseDispatcher.java
index 89cb7d934..54ade5c28 100644
--- a/src/java/com/threerings/presents/server/TimeBaseDispatcher.java
+++ b/src/java/com/threerings/presents/server/TimeBaseDispatcher.java
@@ -45,7 +45,6 @@ public class TimeBaseDispatcher extends InvocationDispatcher
return new TimeBaseMarshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/presents/tools/ActionScriptSource.java b/src/java/com/threerings/presents/tools/ActionScriptSource.java
index d31865ac4..d810975c8 100644
--- a/src/java/com/threerings/presents/tools/ActionScriptSource.java
+++ b/src/java/com/threerings/presents/tools/ActionScriptSource.java
@@ -184,7 +184,7 @@ public class ActionScriptSource
return builder.toString();
}
- public static String createActionScriptDeclaration (Constructor ctor, boolean needsNoArg)
+ public static String createActionScriptDeclaration (Constructor> ctor, boolean needsNoArg)
{
int mods = ctor.getModifiers();
StringBuilder builder = new StringBuilder();
@@ -262,7 +262,7 @@ public class ActionScriptSource
return builder.toString();
}
- public static String toActionScriptType (Class type, boolean isField)
+ public static String toActionScriptType (Class> type, boolean isField)
{
if (type.isArray()) {
if (Byte.TYPE.equals(type.getComponentType())) {
@@ -294,11 +294,11 @@ public class ActionScriptSource
return toSimpleName(type.getName());
}
- public ActionScriptSource (Class jclass)
+ public ActionScriptSource (Class> jclass)
{
packageName = jclass.getPackage().getName();
className = jclass.getName().substring(packageName.length()+1);
- Class sclass = jclass.getSuperclass();
+ Class> sclass = jclass.getSuperclass();
if (sclass != null && !sclass.getName().equals("java.lang.Object")) {
superClassName = toSimpleName(sclass.getName());
}
@@ -306,7 +306,7 @@ public class ActionScriptSource
// note our implemented interfaces
ArrayList ifaces = new ArrayList();
- for (Class iclass : jclass.getInterfaces()) {
+ for (Class> iclass : jclass.getInterfaces()) {
// we cannot use the FooCodes interface pattern in ActionScript so we just nix it
if (iclass.getName().endsWith("Codes")) {
continue;
diff --git a/src/java/com/threerings/presents/tools/GenActionScriptBundlesTask.java b/src/java/com/threerings/presents/tools/GenActionScriptBundlesTask.java
index 549a688f8..eb9437c4e 100644
--- a/src/java/com/threerings/presents/tools/GenActionScriptBundlesTask.java
+++ b/src/java/com/threerings/presents/tools/GenActionScriptBundlesTask.java
@@ -95,7 +95,7 @@ public class GenActionScriptBundlesTask extends Task
if (true) {
// create an array with all the values, then populate in a loop
out.println(" var data :Array = [");
- for (Map.Entry entry : props.entrySet()) {
+ for (Map.Entry entry : props.entrySet()) {
String key = saveConvert((String) entry.getKey());
String val = saveConvert((String) entry.getValue());
out.println(" \"" + key + "\", \"" + val + "\",");
@@ -110,7 +110,7 @@ public class GenActionScriptBundlesTask extends Task
// alternate impl: just set each value directly. For non-trivial
// resource bundles, this generates a larger class after compilation
out.println(" var o :Object = new Object();");
- for (Map.Entry entry : props.entrySet()) {
+ for (Map.Entry entry : props.entrySet()) {
String key = saveConvert((String) entry.getKey());
String val = saveConvert((String) entry.getValue());
out.println(" o[\"" + key + "\"] = \"" + val + "\";");
diff --git a/src/java/com/threerings/presents/tools/GenActionScriptTask.java b/src/java/com/threerings/presents/tools/GenActionScriptTask.java
index 250d96b4f..3fd84bbd2 100644
--- a/src/java/com/threerings/presents/tools/GenActionScriptTask.java
+++ b/src/java/com/threerings/presents/tools/GenActionScriptTask.java
@@ -246,7 +246,7 @@ public class GenActionScriptTask extends Task
return !Modifier.isStatic(mods) && !Modifier.isTransient(mods);
}
- protected String toReadObject (Class type)
+ protected String toReadObject (Class> type)
{
if (type.equals(String.class)) {
return "(ins.readField(String) as String)";
@@ -296,7 +296,7 @@ public class GenActionScriptTask extends Task
}
}
- protected String toWriteObject (Class type, String name)
+ protected String toWriteObject (Class> type, String name)
{
if (type.equals(Integer.class)) {
return "writeObject(new Integer(" + name + "))";
diff --git a/src/java/com/threerings/presents/tools/GenDObjectTask.java b/src/java/com/threerings/presents/tools/GenDObjectTask.java
index 2d25b06b8..41e146da1 100644
--- a/src/java/com/threerings/presents/tools/GenDObjectTask.java
+++ b/src/java/com/threerings/presents/tools/GenDObjectTask.java
@@ -142,7 +142,7 @@ public class GenDObjectTask extends Task
}
/** Processes a resolved distributed object class instance. */
- protected void processObject (File source, Class oclass)
+ protected void processObject (File source, Class> oclass)
{
// make sure we extend distributed object
if (!_doclass.isAssignableFrom(oclass) || _doclass.equals(oclass)) {
@@ -226,8 +226,7 @@ public class GenDObjectTask extends Task
if (t instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)t;
if (pt.getActualTypeArguments().length > 0) {
- ctx.put("etype", GenUtil.simpleName(
- (Class>)pt.getActualTypeArguments()[0]));
+ ctx.put("etype", GenUtil.simpleName(pt.getActualTypeArguments()[0]));
}
} else {
ctx.put("etype", "DSet.Entry");
diff --git a/src/java/com/threerings/presents/tools/GenReceiverTask.java b/src/java/com/threerings/presents/tools/GenReceiverTask.java
index 955473921..c183ff6ac 100644
--- a/src/java/com/threerings/presents/tools/GenReceiverTask.java
+++ b/src/java/com/threerings/presents/tools/GenReceiverTask.java
@@ -46,7 +46,7 @@ import com.threerings.presents.server.InvocationSender;
public class GenReceiverTask extends InvocationTask
{
@Override
- protected void processService (File source, Class receiver)
+ protected void processService (File source, Class> receiver)
{
System.out.println("Processing " + receiver.getName() + "...");
String rname = receiver.getName();
@@ -92,7 +92,7 @@ public class GenReceiverTask extends InvocationTask
}
protected void generateSender (File source, String rname, String rpackage,
- List methods, Iterator imports)
+ List> methods, Iterator imports)
{
String name = StringUtil.replace(rname, "Receiver", "");
String spackage = StringUtil.replace(rpackage, ".client", ".server");
@@ -130,8 +130,7 @@ public class GenReceiverTask extends InvocationTask
}
protected void generateDecoder (
- File source, String rname, String rpackage, List methods,
- Iterator imports)
+ File source, String rname, String rpackage, List> methods, Iterator imports)
{
String name = StringUtil.replace(rname, "Receiver", "");
diff --git a/src/java/com/threerings/presents/tools/GenServiceTask.java b/src/java/com/threerings/presents/tools/GenServiceTask.java
index 145c74d92..0c8ff7d15 100644
--- a/src/java/com/threerings/presents/tools/GenServiceTask.java
+++ b/src/java/com/threerings/presents/tools/GenServiceTask.java
@@ -57,7 +57,7 @@ public class GenServiceTask extends InvocationTask
/** Used to keep track of custom InvocationListener derivations. */
public class ServiceListener implements Comparable
{
- public Class listener;
+ public Class> listener;
public ComparableArrayList methods =
new ComparableArrayList();
@@ -65,7 +65,7 @@ public class GenServiceTask extends InvocationTask
/** Contains all imports required for the parameters of the methods in this listener. */
public ImportSet imports = new ImportSet();
- public ServiceListener (Class service, Class listener)
+ public ServiceListener (Class> service, Class> listener)
{
this.listener = listener;
Method[] methdecls = listener.getDeclaredMethods();
@@ -141,7 +141,7 @@ public class GenServiceTask extends InvocationTask
// documentation inherited
@Override
- protected void processService (File source, Class service)
+ protected void processService (File source, Class> service)
{
System.out.println("Processing " + service.getName() + "...");
@@ -303,7 +303,7 @@ public class GenServiceTask extends InvocationTask
// ----------- Part III - as listener marshallers
- Class imlm = InvocationMarshaller.ListenerMarshaller.class;
+ Class> imlm = InvocationMarshaller.ListenerMarshaller.class;
// now generate ActionScript versions of our listener marshallers
// because those have to be in separate files
@@ -401,7 +401,7 @@ public class GenServiceTask extends InvocationTask
// ----------- Part V - as service listeners
- Class isil = InvocationService.InvocationListener.class;
+ Class> isil = InvocationService.InvocationListener.class;
// also generate ActionScript versions of any inner listener
// interfaces because those have to be in separate files
@@ -585,7 +585,7 @@ public class GenServiceTask extends InvocationTask
/** Rolls up everything needed for the generate* methods. */
protected class ServiceDescription
{
- public Class service;
+ public Class> service;
public String sname;
public String spackage;
public ImportSet imports = new ImportSet();
@@ -594,7 +594,7 @@ public class GenServiceTask extends InvocationTask
public ComparableArrayList listeners =
new ComparableArrayList();
- public ServiceDescription (Class serviceClass)
+ public ServiceDescription (Class> serviceClass)
{
service = serviceClass;
sname = service.getSimpleName();
@@ -611,7 +611,7 @@ public class GenServiceTask extends InvocationTask
continue;
}
// check this method for custom listener declarations
- Class[] args = m.getParameterTypes();
+ Class>[] args = m.getParameterTypes();
for (int aa = 0; aa < args.length; aa++) {
if (_ilistener.isAssignableFrom(args[aa]) &&
GenUtil.simpleName(args[aa]).startsWith(sname + ".")) {
diff --git a/src/java/com/threerings/presents/tools/GenStreamableTask.java b/src/java/com/threerings/presents/tools/GenStreamableTask.java
index 9c93b9639..1af55e757 100644
--- a/src/java/com/threerings/presents/tools/GenStreamableTask.java
+++ b/src/java/com/threerings/presents/tools/GenStreamableTask.java
@@ -111,7 +111,7 @@ public class GenStreamableTask extends Task
StringBuffer writebuf = new StringBuffer(WRITE_OPEN);
// see if our parent also implements Streamable
- Class supster = sclass.getSuperclass();
+ Class> supster = sclass.getSuperclass();
do {
if (isStreamableClass(supster)) {
readbuf.append(" super.readObject(ins);\n");
@@ -174,9 +174,9 @@ public class GenStreamableTask extends Task
}
}
- protected boolean isStreamableClass (Class clazz)
+ protected boolean isStreamableClass (Class> clazz)
{
- for (Class iface : clazz.getInterfaces()) {
+ for (Class> iface : clazz.getInterfaces()) {
if (Streamable.class.equals(iface)) {
return !SimpleStreamableObject.class.equals(clazz);
}
diff --git a/src/java/com/threerings/presents/tools/GenUtil.java b/src/java/com/threerings/presents/tools/GenUtil.java
index ddb043872..141efd77f 100644
--- a/src/java/com/threerings/presents/tools/GenUtil.java
+++ b/src/java/com/threerings/presents/tools/GenUtil.java
@@ -53,7 +53,7 @@ public class GenUtil extends com.samskivert.util.GenUtil
public static String simpleASName (Class> clazz)
{
if (clazz.isArray()) {
- Class compoType = clazz.getComponentType();
+ Class> compoType = clazz.getComponentType();
if (Byte.TYPE.equals(compoType)) {
return "ByteArray";
} else if (Object.class.equals(compoType)) {
diff --git a/src/java/com/threerings/presents/tools/ImportSet.java b/src/java/com/threerings/presents/tools/ImportSet.java
index 949712da3..b4b28721d 100644
--- a/src/java/com/threerings/presents/tools/ImportSet.java
+++ b/src/java/com/threerings/presents/tools/ImportSet.java
@@ -51,7 +51,7 @@ public class ImportSet
* Adds the given class' name to the set of imports.
* @param clazz the class to add
*/
- public void add (Class clazz)
+ public void add (Class> clazz)
{
_imports.add(clazz.getName());
}
diff --git a/src/java/com/threerings/presents/tools/InvocationTask.java b/src/java/com/threerings/presents/tools/InvocationTask.java
index 1504e7cae..cb1076736 100644
--- a/src/java/com/threerings/presents/tools/InvocationTask.java
+++ b/src/java/com/threerings/presents/tools/InvocationTask.java
@@ -61,7 +61,7 @@ public abstract class InvocationTask extends Task
{
public int index;
- public Class listener;
+ public Class> listener;
public ListenerArgument (int index, Class> listener)
{
@@ -274,7 +274,7 @@ public abstract class InvocationTask extends Task
protected String unboxArgument (Type type, int index, boolean listenerMode)
{
if (listenerMode && (type instanceof Class) &&
- _ilistener.isAssignableFrom((Class)type)) {
+ _ilistener.isAssignableFrom((Class>)type)) {
return "listener" + index;
} else {
return GenUtil.unboxArgument(type, "args[" + index + "]");
@@ -385,7 +385,7 @@ public abstract class InvocationTask extends Task
}
/** Processes a resolved invocation service class instance. */
- protected abstract void processService (File source, Class service);
+ protected abstract void processService (File source, Class> service);
protected void writeFile (String path, String data)
throws IOException
diff --git a/src/java/com/threerings/presents/tools/dispatcher.tmpl b/src/java/com/threerings/presents/tools/dispatcher.tmpl
index 772634112..ae8368a48 100644
--- a/src/java/com/threerings/presents/tools/dispatcher.tmpl
+++ b/src/java/com/threerings/presents/tools/dispatcher.tmpl
@@ -24,7 +24,6 @@ public class ${name}Dispatcher extends InvocationDispatcher<${name}Marshaller>
return new ${name}Marshaller();
}
- @SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
diff --git a/src/java/com/threerings/presents/tools/dobject_set.tmpl b/src/java/com/threerings/presents/tools/dobject_set.tmpl
index 26f572591..58fba9519 100644
--- a/src/java/com/threerings/presents/tools/dobject_set.tmpl
+++ b/src/java/com/threerings/presents/tools/dobject_set.tmpl
@@ -13,7 +13,7 @@
* the $field set. The set will not change until the
* event is actually propagated through the system.
*/
- public void removeFrom$upfield (Comparable key)
+ public void removeFrom$upfield (Comparable> key)
{
requestEntryRemove($capfield, $field, key);
}
@@ -41,7 +41,6 @@
public void set$upfield ($type value)
{
requestAttributeChange($capfield, value, this.$field);
- @SuppressWarnings("unchecked") $type clone =
- $clonefield;
+ $type clone = $clonefield;
this.$field = clone;
}
diff --git a/src/java/com/threerings/presents/util/ClassUtil.java b/src/java/com/threerings/presents/util/ClassUtil.java
index e51f527e1..e9af43479 100644
--- a/src/java/com/threerings/presents/util/ClassUtil.java
+++ b/src/java/com/threerings/presents/util/ClassUtil.java
@@ -45,7 +45,7 @@ public class ClassUtil
*/
public static Method getMethod (String name, Object target, Map cache)
{
- Class tclass = target.getClass();
+ Class> tclass = target.getClass();
String key = tclass.getName() + ":" + name;
Method method = cache.get(key);
@@ -71,7 +71,7 @@ public class ClassUtil
*/
public static Method getMethod (String name, Object target, Object[] args)
{
- Class tclass = target.getClass();
+ Class> tclass = target.getClass();
Method meth = null;
try {
@@ -98,7 +98,7 @@ public class ClassUtil
* @return the method with the specified name or null if no method with that name could be
* found.
*/
- public static Method findMethod (Class clazz, String name)
+ public static Method findMethod (Class> clazz, String name)
{
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
diff --git a/src/java/com/threerings/presents/util/DatagramSequencer.java b/src/java/com/threerings/presents/util/DatagramSequencer.java
index e5236d6de..f9bd49ce5 100644
--- a/src/java/com/threerings/presents/util/DatagramSequencer.java
+++ b/src/java/com/threerings/presents/util/DatagramSequencer.java
@@ -59,7 +59,7 @@ public class DatagramSequencer
_uout.writeInt(_lastReceived);
// make sure the mapped class set is clear
- Set mappedClasses = _uout.getMappedClasses();
+ Set> mappedClasses = _uout.getMappedClasses();
mappedClasses.clear();
// write the object
@@ -69,7 +69,7 @@ public class DatagramSequencer
if (mappedClasses.isEmpty()) {
mappedClasses = null;
} else {
- _uout.setMappedClasses(new HashSet());
+ _uout.setMappedClasses(new HashSet>());
}
// record the transmission
@@ -123,9 +123,9 @@ public class DatagramSequencer
/** The set of classes for which mappings were included in the datagram (or
* null for none). */
- public Set mappedClasses;
+ public Set> mappedClasses;
- public SendRecord (int number, Set mappedClasses)
+ public SendRecord (int number, Set> mappedClasses)
{
this.number = number;
this.mappedClasses = mappedClasses;
diff --git a/src/java/com/threerings/util/Name.java b/src/java/com/threerings/util/Name.java
index 8d21971ac..817b35be2 100644
--- a/src/java/com/threerings/util/Name.java
+++ b/src/java/com/threerings/util/Name.java
@@ -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())) {
diff --git a/src/java/com/threerings/util/StreamableEnumSet.java b/src/java/com/threerings/util/StreamableEnumSet.java
index 27c91ce4c..4e0987aa5 100644
--- a/src/java/com/threerings/util/StreamableEnumSet.java
+++ b/src/java/com/threerings/util/StreamableEnumSet.java
@@ -70,7 +70,7 @@ public class StreamableEnumSet> extends AbstractSet
public static > StreamableEnumSet copyOf (Collection s)
{
if (s instanceof StreamableEnumSet) {
- @SuppressWarnings("unchecked") StreamableEnumSet set = (StreamableEnumSet)s;
+ StreamableEnumSet set = (StreamableEnumSet)s;
return copyOf(set);
}
if (s.isEmpty()) {
@@ -197,7 +197,7 @@ public class StreamableEnumSet> extends AbstractSet
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> extends AbstractSet
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;
diff --git a/src/java/com/threerings/util/StreamableHashIntMap.java b/src/java/com/threerings/util/StreamableHashIntMap.java
index 382c4fc0b..ecccf0c2d 100644
--- a/src/java/com/threerings/util/StreamableHashIntMap.java
+++ b/src/java/com/threerings/util/StreamableHashIntMap.java
@@ -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 extends HashIntMap
{
int ecount = size();
out.writeInt(ecount);
- for (Iterator iter = intEntrySet().iterator(); iter.hasNext(); ) {
- IntEntry entry = (IntEntry) iter.next();
+ for (IntEntry entry : intEntrySet()) {
out.writeInt(entry.getIntKey());
out.writeObject(entry.getValue());
}
diff --git a/src/java/com/threerings/util/StreamableIntIntMap.java b/src/java/com/threerings/util/StreamableIntIntMap.java
index c7021f815..cd96f3f9f 100644
--- a/src/java/com/threerings/util/StreamableIntIntMap.java
+++ b/src/java/com/threerings/util/StreamableIntIntMap.java
@@ -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());
}
diff --git a/src/java/com/threerings/util/TrackedObject.java b/src/java/com/threerings/util/TrackedObject.java
index a5771db6e..2fb136514 100644
--- a/src/java/com/threerings/util/TrackedObject.java
+++ b/src/java/com/threerings/util/TrackedObject.java
@@ -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 int[] array that represent the number
* of outstanding instance of all {@link TrackedObject}s in the VM.
*/
- public static Tuple getSnapshot ()
+ public static Tuple[], 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 entry : _map.entrySet()) {
+ for (Map.Entry, int[]> entry : _map.entrySet()) {
classes[idx] = entry.getKey();
counts[idx] = entry.getValue()[0];
idx++;
}
}
- return new Tuple(classes, counts);
+ return new Tuple[], int[]>(classes, counts);
}
/** Tracks a mapping from {@link Class} object to active count. */
- protected static HashMap _map = new HashMap();
+ protected static Map, int[]> _map = Maps.newHashMap();
}
diff --git a/tests/src/java/com/threerings/presents/dobj/DSetTest.java b/tests/src/java/com/threerings/presents/dobj/DSetTest.java
index e832d3cca..b5c6a7bca 100644
--- a/tests/src/java/com/threerings/presents/dobj/DSetTest.java
+++ b/tests/src/java/com/threerings/presents/dobj/DSetTest.java
@@ -38,7 +38,7 @@ public class DSetTest extends TestCase
_value = new Integer(value);
}
- public Comparable getKey ()
+ public Comparable> getKey ()
{
return _value;
}