junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
777 stars 112 forks source link

[BUG] Injection with Java Generics produce a `MundaneWireException` only in GWT #649

Open fgnm opened 2 years ago

fgnm commented 2 years ago

Hello, I use artemis with libGDX and GWT, I've noticed that a MundaneWireException is raised when the game run with GWT and there's a structure that uses generics like this example:

public class GenericObject {

}
public class SpecificObject extends GenericObject {

}
public abstract class SuperGenericClass<T extends GenericObject> {
    protected ComponentMapper<CustomComponent> componentMapper;

   public abstract T getObject();
}
public class SpecificClass extends SuperGenericClass<SpecificObject> {
    protected ComponentMapper<SpecificComponent> specificMapper;

    public SpecificObject getObject() {
          return new SpecificObject();
    }
}

The exception is raised when I do something like:

SuperGenericClass specificClass = new SpecificClass();
world.inject(specificClass);

The issue only happens in GWT but works on any other platforms. Using the same structure, but without generics, works also on GWT.