Some Galileo inspired raw type and dead code elimination.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5956 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-09-14 22:20:16 +00:00
parent 26d982ae54
commit 293ec52255
9 changed files with 30 additions and 31 deletions
@@ -222,7 +222,7 @@ public abstract class ConfigRegistry
{
// mirror this configuration update to the persistent config
Object value = event.getValue();
if (value instanceof DSet) {
if (value instanceof DSet<?>) {
serializeAttribute(event.getName());
} else {
updateValue(event.getName(), value);
+1 -1
View File
@@ -88,7 +88,7 @@ public class Streamer
*/
public static Class<?> getStreamerClass (Object object)
{
return (object instanceof Enum) ?
return (object instanceof Enum<?>) ?
((Enum<?>)object).getDeclaringClass() : object.getClass();
}
@@ -95,7 +95,7 @@ public class EntryAddedEvent<T extends DSet.Entry> extends NamedEvent
@Override
protected void notifyListener (Object listener)
{
if (listener instanceof SetListener) {
if (listener instanceof SetListener<?>) {
@SuppressWarnings("unchecked") SetListener<T> setlist = (SetListener<T>)listener;
setlist.entryAdded(this);
}
@@ -101,7 +101,7 @@ public class EntryRemovedEvent<T extends DSet.Entry> extends NamedEvent
@Override
protected void notifyListener (Object listener)
{
if (listener instanceof SetListener) {
if (listener instanceof SetListener<?>) {
@SuppressWarnings("unchecked") SetListener<T> setlist = (SetListener<T>)listener;
setlist.entryRemoved(this);
}
@@ -120,7 +120,7 @@ public class EntryUpdatedEvent<T extends DSet.Entry> extends NamedEvent
@Override
protected void notifyListener (Object listener)
{
if (listener instanceof SetListener) {
if (listener instanceof SetListener<?>) {
@SuppressWarnings("unchecked") SetListener<T> setlist = (SetListener<T>)listener;
setlist.entryUpdated(this);
}
@@ -131,7 +131,7 @@ public class ReportingInvoker extends Invoker
if (PresentsDObjectMgr.UNIT_PROF_ENABLED) {
for (Object key : _tracker.keySet()) {
UnitProfile profile = _tracker.get(key);
if (key instanceof Class) {
if (key instanceof Class<?>) {
key = StringUtil.shortClassName((Class<?>)key);
}
buf.append(" ").append(key).append(" ");
@@ -94,30 +94,29 @@ public class GenActionScriptBundlesTask extends Task
out.println("{");
out.println(" override protected function getContent () :Object");
out.println(" {");
if (true) {
// create an array with all the values, then populate in a loop
out.println(" var data :Array = [");
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key = saveConvert((String) entry.getKey());
String val = saveConvert((String) entry.getValue());
out.println(" \"" + key + "\", \"" + val + "\",");
}
out.println(" null];");
out.println(" var o :Object = new Object();");
out.println(" for (var ii :int = 0; ii < data.length; ii += 2) {");
out.println(" o[data[ii]] = data[ii + 1];");
out.println(" }");
} else {
// 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<Object, Object> entry : props.entrySet()) {
String key = saveConvert((String) entry.getKey());
String val = saveConvert((String) entry.getValue());
out.println(" o[\"" + key + "\"] = \"" + val + "\";");
}
// create an array with all the values, then populate in a loop
out.println(" var data :Array = [");
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key = saveConvert((String) entry.getKey());
String val = saveConvert((String) entry.getValue());
out.println(" \"" + key + "\", \"" + val + "\",");
}
out.println(" null];");
out.println(" var o :Object = new Object();");
out.println(" for (var ii :int = 0; ii < data.length; ii += 2) {");
out.println(" o[data[ii]] = data[ii + 1];");
out.println(" }");
// // 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<Object, Object> entry : props.entrySet()) {
// String key = saveConvert((String) entry.getKey());
// String val = saveConvert((String) entry.getValue());
// out.println(" o[\"" + key + "\"] = \"" + val + "\";");
// }
out.println(" return o;");
out.println(" }");
out.println("}}");
@@ -142,7 +142,7 @@ public abstract class InvocationTask extends Task
protected void addImportsForType (Type type, ImportSet imports)
{
if (type instanceof Class) {
if (type instanceof Class<?>) {
imports.add((Class<?>)type);
} else if (type instanceof ParameterizedType) {
imports.add((Class<?>)((ParameterizedType)type).getRawType());
@@ -326,7 +326,7 @@ public abstract class InvocationTask extends Task
protected String unboxArgument (Type type, int index, boolean listenerMode)
{
if (listenerMode && (type instanceof Class) &&
if (listenerMode && (type instanceof Class<?>) &&
_ilistener.isAssignableFrom((Class<?>)type)) {
return "listener" + index;
} else {
@@ -70,7 +70,7 @@ public class StreamableEnumSet<E extends Enum<E>> extends AbstractSet<E>
*/
public static <E extends Enum<E>> StreamableEnumSet<E> copyOf (Collection<E> s)
{
if (s instanceof StreamableEnumSet) {
if (s instanceof StreamableEnumSet<?>) {
StreamableEnumSet<E> set = (StreamableEnumSet<E>)s;
return copyOf(set);
}