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 -->
<target name="compile" depends="check-available,prepare">
<javac srcdir="${src.dir}" destdir="${classes.dir}"
debug="on" optimize="off" deprecation="off">
debug="on" optimize="off" deprecation="on">
<classpath refid="classpath"/>
<exclude name="com/threerings/jme/**" unless="build.jme"/>
<exclude name="com/threerings/openal/**" unless="build.openal"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
@@ -67,7 +67,7 @@ public class TestClient
// loop over our queue, running the runnables
while (true) {
Runnable run = (Runnable)_queue.get();
Runnable run = _queue.get();
run.run();
}
}
@@ -184,5 +184,5 @@ public class TestClient
protected ChatDirector _chatdir;
protected Thread _main;
protected Queue _queue = new Queue();
protected Queue<Runnable> _queue = new Queue<Runnable>();
}
@@ -4,6 +4,7 @@
package com.threerings.crowd.data;
import com.threerings.crowd.client.JabberController;
import com.threerings.crowd.client.PlaceController;
import com.threerings.crowd.data.PlaceConfig;
/**
@@ -12,9 +13,9 @@ import com.threerings.crowd.data.PlaceConfig;
public class JabberConfig extends PlaceConfig
{
// documentation inherited
public Class getControllerClass ()
public PlaceController createController ()
{
return JabberController.class;
return new JabberController();
}
// documentation inherited
@@ -35,7 +35,7 @@ import com.threerings.presents.net.*;
* A standalone test client.
*/
public class TestClient
implements RunQueue, SessionObserver, Subscriber, EventListener,
implements RunQueue, SessionObserver, Subscriber<TestObject>, EventListener,
TestService.TestFuncListener, TestService.TestOidListener,
TestReceiver
{
@@ -61,7 +61,7 @@ public class TestClient
// loop over our queue, running the runnables
while (true) {
Runnable run = (Runnable)_queue.get();
Runnable run = _queue.get();
run.run();
}
}
@@ -91,11 +91,11 @@ public class TestClient
System.exit(0);
}
public void objectAvailable (DObject object)
public void objectAvailable (TestObject object)
{
object.addListener(this);
Log.info("Object available: " + object);
((TestObject)object).setBar("lawl!");
object.setBar("lawl!");
}
public void requestFailed (int oid, ObjectAccessException cause)
@@ -161,6 +161,6 @@ public class TestClient
}
protected Thread _main;
protected Queue _queue = new Queue();
protected Queue<Runnable> _queue = new Queue<Runnable>();
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
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -58,14 +58,14 @@ public class DSetTest extends TestCase
public void runTest ()
{
ArrayList seed = new ArrayList();
ArrayList<TestEntry> seed = new ArrayList<TestEntry>();
seed.add(new TestEntry(15));
seed.add(new TestEntry(7));
seed.add(new TestEntry(3));
seed.add(new TestEntry(29));
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(9)) + ": " + 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.
*/
public class DOMTest extends TestCase
implements Subscriber, AttributeChangeListener, ElementUpdateListener
implements Subscriber<TestObject>, AttributeChangeListener,
ElementUpdateListener
{
public DOMTest ()
{
super(DOMTest.class.getName());
}
public void objectAvailable (DObject object)
public void objectAvailable (TestObject object)
{
// add ourselves as a listener
object.addListener(this);
TestObject to = (TestObject)object;
_test = to;
_test = object;
_test.addListener(this);
// test transactions
to.startTransaction();
to.setFoo(99);
to.setBar("hoopie");
to.commitTransaction();
_test.startTransaction();
_test.setFoo(99);
_test.setBar("hoopie");
_test.commitTransaction();
// set some elements
to.setIntsAt(15, 3);
to.setIntsAt(5, 2);
to.setIntsAt(1, 0);
to.setStringsAt("Hello", 0);
to.setStringsAt("Goodbye", 1);
to.setStringsAt(null, 1);
_test.setIntsAt(15, 3);
_test.setIntsAt(5, 2);
_test.setIntsAt(1, 0);
_test.setStringsAt("Hello", 0);
_test.setStringsAt("Goodbye", 1);
_test.setStringsAt(null, 1);
// now set some values straight up
to.setFoo(25);
to.setBar("howdy");
_test.setFoo(25);
_test.setBar("howdy");
}
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
* an oid list.
*/
public class DestroyedRefTest
extends TestCase
implements Subscriber, EventListener
public class DestroyedRefTest extends TestCase
implements Subscriber<TestObject>, EventListener
{
public DestroyedRefTest ()
{
super(DestroyedRefTest.class.getName());
}
public void objectAvailable (DObject object)
public void objectAvailable (TestObject object)
{
// add ourselves as an event listener
object.addListener(this);
// keep references to our test objects
if (_objone == null) {
_objone = (TestObject)object;
_objone = object;
} else {
_objtwo = (TestObject)object;
_objtwo = object;
// add object one to object two twice in a row to make sure
// 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.
*/
public class RefTest
extends TestCase
implements Subscriber, EventListener
public class RefTest extends TestCase
implements Subscriber<TestObject>, EventListener
{
public RefTest ()
{
super(RefTest.class.getName());
}
public void objectAvailable (DObject object)
public void objectAvailable (TestObject object)
{
// add ourselves as an event listener to our subscribed object
object.addListener(this);
// keep references to our test objects
if (_objone == null) {
_objone = (TestObject)object;
_objone = object;
} else {
_objtwo = (TestObject)object;
_objtwo = object;
// now that we have both objects, set up the references
_objone.addToList(_objtwo.getOid());
_objtwo.addToList(_objone.getOid());
@@ -38,15 +38,11 @@ public class TestServer extends PresentsServer
invmgr.registerDispatcher(new TestDispatcher(new TestProvider()), true);
// create a test object
Subscriber sub = new Subscriber()
{
public void objectAvailable (DObject object)
{
testobj = (TestObject)object;
Subscriber<TestObject> sub = new Subscriber<TestObject>() {
public void objectAvailable (TestObject object) {
testobj = object;
}
public void requestFailed (int oid, ObjectAccessException cause)
{
public void requestFailed (int oid, ObjectAccessException cause) {
Log.warning("Unable to create test object " +
"[error=" + cause + "].");
}