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
@@ -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<Name> chatternames);
}
/**
@@ -49,7 +49,6 @@ public class ChatDispatcher extends InvocationDispatcher<ChatMarshaller>
return new ChatMarshaller();
}
@SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
@@ -46,7 +46,6 @@ public class SpeakDispatcher extends InvocationDispatcher<SpeakMarshaller>
return new SpeakMarshaller();
}
@SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
@@ -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<OccupantInfo>
{
/**
* 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<OccupantInfo> 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<OccupantObserver>() {
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<OccupantInfo> 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<OccupantObserver>() {
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<OccupantInfo> 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<OccupantObserver>() {
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<OccupantObserver> _observers =
new ObserverList<OccupantObserver>(ObserverList.SAFE_IN_ORDER_NOTIFY);
protected ObserverList<OccupantObserver> _observers = ObserverList.newSafeInOrder();
/** The user's current location. */
protected PlaceObject _place;
@@ -85,7 +85,7 @@ public class OccupantInfo extends SimpleStreamableObject
}
// documentation inherited
public Comparable getKey ()
public Comparable<?> getKey ()
{
return bodyOid;
}
@@ -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.");
@@ -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 <code>occupantInfo</code> 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<OccupantInfo> value)
{
requestAttributeChange(OCCUPANT_INFO, value, this.occupantInfo);
@SuppressWarnings("unchecked") DSet<OccupantInfo> clone =
(value == null) ? null : value.typedClone();
DSet<OccupantInfo> clone = (value == null) ? null : value.typedClone();
this.occupantInfo = clone;
}
@@ -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
@@ -49,7 +49,6 @@ public class CrowdPeerDispatcher extends InvocationDispatcher<CrowdPeerMarshalle
return new CrowdPeerMarshaller();
}
@SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
@@ -46,7 +46,6 @@ public class BodyDispatcher extends InvocationDispatcher<BodyMarshaller>
return new BodyMarshaller();
}
@SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
@@ -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;
@@ -47,7 +47,6 @@ public class LocationDispatcher extends InvocationDispatcher<LocationMarshaller>
return new LocationMarshaller();
}
@SuppressWarnings("unchecked")
@Override // documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
@@ -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<DSet.Entry>(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<OccupantInfo> _bodyUpdater = new SetAdapter<OccupantInfo>() {
@Override
public void entryUpdated (EntryUpdatedEvent event) {
public void entryUpdated (EntryUpdatedEvent<OccupantInfo> 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