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
@@ -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;
}