DaanVanYperen / artemis-odb-contrib

Drop-in extensions for artemis-odb. Prefab systems, components, networking, events!
MIT License
75 stars 19 forks source link

Fix ClassCastException when @Singleton fields don't extend Component #133

Closed schosin closed 4 years ago

schosin commented 4 years ago

Fixes a ClassCastException when annotated classes don't extend Component. I also added a couple tests. Haven't used JUnit 4 in a long time though.

Got another feature in my fork, adding a strict mode for the SingletonPlugin, which throws an exception when an entity enters the world with a singleton component added to it. I can create a PR if you're interested.

DaanVanYperen commented 4 years ago

Awesome! Got to think a sec about the Strict clause,

DaanVanYperen commented 4 years ago

Awesome! Got to think a sec about the Strict clause,

As in, maybe it should be default.

schosin commented 4 years ago

My thought process was having it enabled during development and disabled for production, that's why I went with the save route.

schosin commented 4 years ago

The strict mode currently is in another branch. I add it to this PR if you prefer that, the title just wouldn't match currently.

DaanVanYperen commented 4 years ago

Submit it separately is fine :)