Properly quell the unchecked warning. I'm not entirely sure whether there is a

construct that could be made to do what I want in a type safe manner. The
method returns Class<? extends NodeObject> which is correctly expresses the
valid types that can be returned.

However, I can't pass the capture <? extends NodeObject> (NodeObject extends
DObject) to a method that takes <T extends DObject>. I'm not entirely sure why
not, but I imagine it has something to do with the subtleties of type-erasure,
or maybe it's just a limitation of the inference that can be done by the
compiler. I don't know what type <? extends NodeObject> is considered to be, I
would have thought just NodeObject but apparently not.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4242 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-07-04 02:20:10 +00:00
parent 3a9c6ced44
commit 40d0df6dfa
@@ -105,7 +105,8 @@ public class PeerManager
this, PresentsServer.clmgr.getClientFactory()));
// create our node object
Class<NodeObject> clazz = (Class<NodeObject>)getNodeObjectClass();
@SuppressWarnings("unchecked") Class<NodeObject> clazz =
(Class<NodeObject>)getNodeObjectClass();
PresentsServer.omgr.createObject(clazz, new Subscriber<NodeObject>() {
public void objectAvailable (NodeObject object) {
finishInit(object);