I have this class:
public class ActorFixture<T>
{
public T actor;
public String fixture;
public ActorFixture() {}
public ActorFixture(T actor, String fixture)
{
this.actor = actor;
this.fixture = fixture;
}
public void setFixture(Fixture fa, Fixture fb)
{
Class<T> type;
if (type.isInstance(fa))
{
actor = type.cast(fa.getBody().getUserData());
fixture = (String)fa.getUserData();
}
else if (type.isInstance(fb))
{
actor = type.cast(fb.getBody().getUserData());
fixture = (String)fb.getUserData();
}
}
}
But I get a warning on 'type' because it's not initialized.
What's the correct way to check the type?