Fixed type-unsafety and deprecation bits.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4247 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-07-05 18:59:31 +00:00
parent bdadd2377e
commit 77290fc1a6
9 changed files with 46 additions and 52 deletions
+2 -1
View File
@@ -106,10 +106,11 @@
<!-- build the java class files --> <!-- build the java class files -->
<target name="compile" depends="check-available,prepare"> <target name="compile" depends="check-available,prepare">
<javac srcdir="${src.dir}" destdir="${classes.dir}" <javac srcdir="${src.dir}" destdir="${classes.dir}"
debug="on" optimize="off" deprecation="off"> debug="on" optimize="off" deprecation="on">
<classpath refid="classpath"/> <classpath refid="classpath"/>
<exclude name="com/threerings/jme/**" unless="build.jme"/> <exclude name="com/threerings/jme/**" unless="build.jme"/>
<exclude name="com/threerings/openal/**" unless="build.openal"/> <exclude name="com/threerings/openal/**" unless="build.openal"/>
<compilerarg value="-Xlint:unchecked"/>
</javac> </javac>
</target> </target>
@@ -67,7 +67,7 @@ public class TestClient
// loop over our queue, running the runnables // loop over our queue, running the runnables
while (true) { while (true) {
Runnable run = (Runnable)_queue.get(); Runnable run = _queue.get();
run.run(); run.run();
} }
} }
@@ -184,5 +184,5 @@ public class TestClient
protected ChatDirector _chatdir; protected ChatDirector _chatdir;
protected Thread _main; protected Thread _main;
protected Queue _queue = new Queue(); protected Queue<Runnable> _queue = new Queue<Runnable>();
} }
@@ -4,6 +4,7 @@
package com.threerings.crowd.data; package com.threerings.crowd.data;
import com.threerings.crowd.client.JabberController; import com.threerings.crowd.client.JabberController;
import com.threerings.crowd.client.PlaceController;
import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceConfig;
/** /**
@@ -12,9 +13,9 @@ import com.threerings.crowd.data.PlaceConfig;
public class JabberConfig extends PlaceConfig public class JabberConfig extends PlaceConfig
{ {
// documentation inherited // documentation inherited
public Class getControllerClass () public PlaceController createController ()
{ {
return JabberController.class; return new JabberController();
} }
// documentation inherited // documentation inherited
@@ -35,7 +35,7 @@ import com.threerings.presents.net.*;
* A standalone test client. * A standalone test client.
*/ */
public class TestClient public class TestClient
implements RunQueue, SessionObserver, Subscriber, EventListener, implements RunQueue, SessionObserver, Subscriber<TestObject>, EventListener,
TestService.TestFuncListener, TestService.TestOidListener, TestService.TestFuncListener, TestService.TestOidListener,
TestReceiver TestReceiver
{ {
@@ -61,7 +61,7 @@ public class TestClient
// loop over our queue, running the runnables // loop over our queue, running the runnables
while (true) { while (true) {
Runnable run = (Runnable)_queue.get(); Runnable run = _queue.get();
run.run(); run.run();
} }
} }
@@ -91,11 +91,11 @@ public class TestClient
System.exit(0); System.exit(0);
} }
public void objectAvailable (DObject object) public void objectAvailable (TestObject object)
{ {
object.addListener(this); object.addListener(this);
Log.info("Object available: " + object); Log.info("Object available: " + object);
((TestObject)object).setBar("lawl!"); object.setBar("lawl!");
} }
public void requestFailed (int oid, ObjectAccessException cause) public void requestFailed (int oid, ObjectAccessException cause)
@@ -161,6 +161,6 @@ public class TestClient
} }
protected Thread _main; protected Thread _main;
protected Queue _queue = new Queue(); protected Queue<Runnable> _queue = new Queue<Runnable>();
protected Client _client; protected Client _client;
} }
@@ -1,5 +1,5 @@
// //
// $Id: DSetTest.java,v 1.2 2004/08/27 02:21:04 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -58,14 +58,14 @@ public class DSetTest extends TestCase
public void runTest () public void runTest ()
{ {
ArrayList seed = new ArrayList(); ArrayList<TestEntry> seed = new ArrayList<TestEntry>();
seed.add(new TestEntry(15)); seed.add(new TestEntry(15));
seed.add(new TestEntry(7)); seed.add(new TestEntry(7));
seed.add(new TestEntry(3)); seed.add(new TestEntry(3));
seed.add(new TestEntry(29)); seed.add(new TestEntry(29));
seed.add(new TestEntry(32)); seed.add(new TestEntry(32));
DSet set = new DSet(seed.iterator()); DSet<TestEntry> set = new DSet<TestEntry>(seed.iterator());
System.out.println(set.add(new TestEntry(15)) + ": " + set); System.out.println(set.add(new TestEntry(15)) + ": " + set);
System.out.println(set.add(new TestEntry(9)) + ": " + set); System.out.println(set.add(new TestEntry(9)) + ": " + set);
System.out.println(set.remove(new TestEntry(32)) + ": " + set); System.out.println(set.remove(new TestEntry(32)) + ": " + set);
@@ -31,38 +31,37 @@ import com.threerings.presents.dobj.*;
* A simple test case for the dobjmgr. * A simple test case for the dobjmgr.
*/ */
public class DOMTest extends TestCase public class DOMTest extends TestCase
implements Subscriber, AttributeChangeListener, ElementUpdateListener implements Subscriber<TestObject>, AttributeChangeListener,
ElementUpdateListener
{ {
public DOMTest () public DOMTest ()
{ {
super(DOMTest.class.getName()); super(DOMTest.class.getName());
} }
public void objectAvailable (DObject object) public void objectAvailable (TestObject object)
{ {
// add ourselves as a listener // add ourselves as a listener
object.addListener(this); _test = object;
_test.addListener(this);
TestObject to = (TestObject)object;
_test = to;
// test transactions // test transactions
to.startTransaction(); _test.startTransaction();
to.setFoo(99); _test.setFoo(99);
to.setBar("hoopie"); _test.setBar("hoopie");
to.commitTransaction(); _test.commitTransaction();
// set some elements // set some elements
to.setIntsAt(15, 3); _test.setIntsAt(15, 3);
to.setIntsAt(5, 2); _test.setIntsAt(5, 2);
to.setIntsAt(1, 0); _test.setIntsAt(1, 0);
to.setStringsAt("Hello", 0); _test.setStringsAt("Hello", 0);
to.setStringsAt("Goodbye", 1); _test.setStringsAt("Goodbye", 1);
to.setStringsAt(null, 1); _test.setStringsAt(null, 1);
// now set some values straight up // now set some values straight up
to.setFoo(25); _test.setFoo(25);
to.setBar("howdy"); _test.setBar("howdy");
} }
public void requestFailed (int oid, ObjectAccessException cause) public void requestFailed (int oid, ObjectAccessException cause)
@@ -32,26 +32,25 @@ import com.threerings.presents.dobj.*;
* Tests that the dobjmgr will not allow a destroyed object to be added to * Tests that the dobjmgr will not allow a destroyed object to be added to
* an oid list. * an oid list.
*/ */
public class DestroyedRefTest public class DestroyedRefTest extends TestCase
extends TestCase implements Subscriber<TestObject>, EventListener
implements Subscriber, EventListener
{ {
public DestroyedRefTest () public DestroyedRefTest ()
{ {
super(DestroyedRefTest.class.getName()); super(DestroyedRefTest.class.getName());
} }
public void objectAvailable (DObject object) public void objectAvailable (TestObject object)
{ {
// add ourselves as an event listener // add ourselves as an event listener
object.addListener(this); object.addListener(this);
// keep references to our test objects // keep references to our test objects
if (_objone == null) { if (_objone == null) {
_objone = (TestObject)object; _objone = object;
} else { } else {
_objtwo = (TestObject)object; _objtwo = object;
// add object one to object two twice in a row to make sure // add object one to object two twice in a row to make sure
// repeated adds don't result in the object being listed twice // repeated adds don't result in the object being listed twice
@@ -30,27 +30,25 @@ import com.threerings.presents.dobj.*;
/** /**
* Tests the oid list reference tracking code. * Tests the oid list reference tracking code.
*/ */
public class RefTest public class RefTest extends TestCase
extends TestCase implements Subscriber<TestObject>, EventListener
implements Subscriber, EventListener
{ {
public RefTest () public RefTest ()
{ {
super(RefTest.class.getName()); super(RefTest.class.getName());
} }
public void objectAvailable (DObject object) public void objectAvailable (TestObject object)
{ {
// add ourselves as an event listener to our subscribed object // add ourselves as an event listener to our subscribed object
object.addListener(this); object.addListener(this);
// keep references to our test objects // keep references to our test objects
if (_objone == null) { if (_objone == null) {
_objone = (TestObject)object; _objone = object;
} else { } else {
_objtwo = (TestObject)object; _objtwo = object;
// now that we have both objects, set up the references // now that we have both objects, set up the references
_objone.addToList(_objtwo.getOid()); _objone.addToList(_objtwo.getOid());
_objtwo.addToList(_objone.getOid()); _objtwo.addToList(_objone.getOid());
@@ -38,15 +38,11 @@ public class TestServer extends PresentsServer
invmgr.registerDispatcher(new TestDispatcher(new TestProvider()), true); invmgr.registerDispatcher(new TestDispatcher(new TestProvider()), true);
// create a test object // create a test object
Subscriber sub = new Subscriber() Subscriber<TestObject> sub = new Subscriber<TestObject>() {
{ public void objectAvailable (TestObject object) {
public void objectAvailable (DObject object) testobj = object;
{
testobj = (TestObject)object;
} }
public void requestFailed (int oid, ObjectAccessException cause) {
public void requestFailed (int oid, ObjectAccessException cause)
{
Log.warning("Unable to create test object " + Log.warning("Unable to create test object " +
"[error=" + cause + "]."); "[error=" + cause + "].");
} }