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:
@@ -252,7 +252,7 @@ public class Client
|
||||
* matches. <em>Note also:</em> 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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public interface InvocationReceiver
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public Comparable getKey ()
|
||||
public Comparable<?> getKey ()
|
||||
{
|
||||
return receiverCode;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ClientObject extends DObject
|
||||
* the <code>receivers</code> 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<InvocationReceiver.Registration> value)
|
||||
{
|
||||
requestAttributeChange(RECEIVERS, value, this.receivers);
|
||||
@SuppressWarnings("unchecked") DSet<InvocationReceiver.Registration> clone =
|
||||
(value == null) ? null : value.typedClone();
|
||||
DSet<InvocationReceiver.Registration> clone = (value == null) ? null : value.typedClone();
|
||||
this.receivers = clone;
|
||||
}
|
||||
// AUTO-GENERATED: METHODS END
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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 <T extends DSet.Entry> void requestEntryRemove (
|
||||
String name, DSet<T> set, Comparable key)
|
||||
String name, DSet<T> 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<Class, Field[]> _ftable = new HashMap<Class, Field[]>();
|
||||
protected static Map<Class<?>, Field[]> _ftable = Maps.newHashMap();
|
||||
|
||||
/** Used to sort and search {@link #_fields}. */
|
||||
protected static final Comparator<Field> FIELD_COMP = new Comparator<Field>() {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DSet<E extends DSet.Entry>
|
||||
* 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<E extends DSet.Entry>
|
||||
return new DSet<E>(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<Object> cc1 = (Comparable<Object>)c1;
|
||||
@SuppressWarnings("unchecked") Comparable<Object> cc2 = (Comparable<Object>)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<E extends DSet.Entry>
|
||||
* Returns true if an entry in the set has a key that <code>equals()</code> 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<E extends DSet.Entry>
|
||||
* Returns the entry that matches (<code>getKey().equals(key)</code>) 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<E extends DSet.Entry>
|
||||
*
|
||||
* @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<E extends DSet.Entry>
|
||||
/** 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<E extends DSet.Entry>
|
||||
/** Used for lookups and to keep the set contents sorted on insertions. */
|
||||
protected static Comparator<Entry> ENTRY_COMP = new Comparator<Entry>() {
|
||||
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());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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<T extends DSet.Entry>
|
||||
implements AttributeChangeListener, ElementUpdateListener, SetListener<T>
|
||||
{
|
||||
/**
|
||||
* 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<T> event)
|
||||
{
|
||||
dispatchMethod(event.getName() + "Added",
|
||||
new Object[] { event.getEntry() });
|
||||
}
|
||||
|
||||
// from interface SetListener
|
||||
public void entryUpdated (EntryUpdatedEvent event)
|
||||
public void entryUpdated (EntryUpdatedEvent<T> event)
|
||||
{
|
||||
dispatchMethod(event.getName() + "Updated",
|
||||
new Object[] { event.getEntry() });
|
||||
}
|
||||
|
||||
// from interface SetListener
|
||||
public void entryRemoved (EntryRemovedEvent event)
|
||||
public void entryRemoved (EntryRemovedEvent<T> 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();
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class EntryRemovedEvent<T extends DSet.Entry> 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<T extends DSet.Entry> 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<T extends DSet.Entry> extends NamedEvent
|
||||
buf.append(", key=").append(_key);
|
||||
}
|
||||
|
||||
protected Comparable _key;
|
||||
protected Comparable<?> _key;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected transient T _oldEntry = (T)UNSET_OLD_ENTRY;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ public class NodeObject extends DObject
|
||||
public String type;
|
||||
|
||||
/** The resource identifier, which can be <code>null</code> 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 <code>clients</code> 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<ClientInfo> value)
|
||||
{
|
||||
requestAttributeChange(CLIENTS, value, this.clients);
|
||||
@SuppressWarnings("unchecked") DSet<ClientInfo> clone =
|
||||
(value == null) ? null : value.typedClone();
|
||||
DSet<ClientInfo> clone = (value == null) ? null : value.typedClone();
|
||||
this.clients = clone;
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ public class NodeObject extends DObject
|
||||
* the <code>locks</code> 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<NodeObject.Lock> value)
|
||||
{
|
||||
requestAttributeChange(LOCKS, value, this.locks);
|
||||
@SuppressWarnings("unchecked") DSet<NodeObject.Lock> clone =
|
||||
(value == null) ? null : value.typedClone();
|
||||
DSet<NodeObject.Lock> clone = (value == null) ? null : value.typedClone();
|
||||
this.locks = clone;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ public class PeerDispatcher extends InvocationDispatcher<PeerMarshaller>
|
||||
return new PeerMarshaller();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override // documentation inherited
|
||||
public void dispatchRequest (
|
||||
ClientObject source, int methodId, Object[] args)
|
||||
|
||||
@@ -989,7 +989,7 @@ public abstract class PeerManager
|
||||
* Handles a lock in a state of resolution.
|
||||
*/
|
||||
protected class LockHandler
|
||||
implements SetListener
|
||||
implements SetListener<NodeObject.Lock>
|
||||
{
|
||||
/** Listeners waiting for resolution. */
|
||||
public ResultListenerList<String> listeners = new ResultListenerList<String>();
|
||||
@@ -1116,7 +1116,7 @@ public abstract class PeerManager
|
||||
}
|
||||
|
||||
// documentation inherited from interface SetListener
|
||||
public void entryAdded (EntryAddedEvent event)
|
||||
public void entryAdded (EntryAddedEvent<NodeObject.Lock> 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<NodeObject.Lock> 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<NodeObject.Lock> event)
|
||||
{
|
||||
if (!_acquire && event.getName().equals(NodeObject.LOCKS) &&
|
||||
event.getEntry().equals(_lock)) {
|
||||
|
||||
@@ -52,13 +52,13 @@ public class PeerUtil
|
||||
S createProviderProxy (Class<S> 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));
|
||||
|
||||
@@ -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<InvocationDispatcher> _dispatchers = IntMaps.newHashIntMap();
|
||||
protected IntMap<InvocationDispatcher<?>> _dispatchers = IntMaps.newHashIntMap();
|
||||
|
||||
/** Maps bootstrap group to lists of services to be provided to clients at boot time. */
|
||||
protected Map<String, List<InvocationMarshaller>> _bootlists = Maps.newHashMap();
|
||||
|
||||
@@ -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<Void> 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<Void>() {
|
||||
public void requestCompleted (Void result) {
|
||||
finishResolved(username, clobj);
|
||||
}
|
||||
public void requestFailed (Exception cause) {
|
||||
|
||||
@@ -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<DEvent> 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<Class, Method> _helpers = Maps.newHashMap();
|
||||
protected Map<Class<?>, Method> _helpers = Maps.newHashMap();
|
||||
|
||||
/** Used to resolve unit names when profiling. Injected by the invmgr when it's created. */
|
||||
protected InvocationManager _invmgr;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 + "].");
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -45,7 +45,6 @@ public class TimeBaseDispatcher extends InvocationDispatcher<TimeBaseMarshaller>
|
||||
return new TimeBaseMarshaller();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override // documentation inherited
|
||||
public void dispatchRequest (
|
||||
ClientObject source, int methodId, Object[] args)
|
||||
|
||||
@@ -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<String> ifaces = new ArrayList<String>();
|
||||
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;
|
||||
|
||||
@@ -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<Object, Object> 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<Object, Object> entry : props.entrySet()) {
|
||||
String key = saveConvert((String) entry.getKey());
|
||||
String val = saveConvert((String) entry.getValue());
|
||||
out.println(" o[\"" + key + "\"] = \"" + val + "\";");
|
||||
|
||||
@@ -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 + "))";
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<String> imports)
|
||||
List<?> methods, Iterator<String> 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<String> imports)
|
||||
File source, String rname, String rpackage, List<?> methods, Iterator<String> imports)
|
||||
{
|
||||
String name = StringUtil.replace(rname, "Receiver", "");
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GenServiceTask extends InvocationTask
|
||||
/** Used to keep track of custom InvocationListener derivations. */
|
||||
public class ServiceListener implements Comparable<ServiceListener>
|
||||
{
|
||||
public Class listener;
|
||||
public Class<?> listener;
|
||||
|
||||
public ComparableArrayList<ServiceMethod> methods =
|
||||
new ComparableArrayList<ServiceMethod>();
|
||||
@@ -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<ServiceListener> listeners =
|
||||
new ComparableArrayList<ServiceListener>();
|
||||
|
||||
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 + ".")) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* the <code>$field</code> 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;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ClassUtil
|
||||
*/
|
||||
public static Method getMethod (String name, Object target, Map<String, Method> 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++) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DatagramSequencer
|
||||
_uout.writeInt(_lastReceived);
|
||||
|
||||
// make sure the mapped class set is clear
|
||||
Set<Class> mappedClasses = _uout.getMappedClasses();
|
||||
Set<Class<?>> 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<Class>());
|
||||
_uout.setMappedClasses(new HashSet<Class<?>>());
|
||||
}
|
||||
|
||||
// record the transmission
|
||||
@@ -123,9 +123,9 @@ public class DatagramSequencer
|
||||
|
||||
/** The set of classes for which mappings were included in the datagram (or
|
||||
* <code>null</code> for none). */
|
||||
public Set<Class> mappedClasses;
|
||||
public Set<Class<?>> mappedClasses;
|
||||
|
||||
public SendRecord (int number, Set<Class> mappedClasses)
|
||||
public SendRecord (int number, Set<Class<?>> mappedClasses)
|
||||
{
|
||||
this.number = number;
|
||||
this.mappedClasses = mappedClasses;
|
||||
|
||||
Reference in New Issue
Block a user