Fix Dependency Injection Support for Behavior Actions #5004
Labels
Status: Needs Investigation
Requires to be debugged or checked for feasibility, etc.
Topic: AI
Requests, Issues and Changes related to pathfinding, behaviors, etc.
Topic: Stabilization
Requests, Issues and Changes related to improving stablity and reducing flakyness
Type: Bug
Issues reporting and PRs fixing problems
Issue
Dependency injection via
@In
is a widely used mechanism throughout our code-base.However, it doesn't seem to be supported or function properly for all kinds of classes yet.
There seems to be an implementation for Behavior Actions. Unfortunately, it doesn't seem to work as expected.
For some reason, the dependency injection sometimes (?) doesn't seem to work and the object to be injected is not initialized and stays
null
, resulting in an NPE when being accessed.I don't know whether this is sufficient and if not, why. I wonder whether this might be related to the respective fields not being registered, yet, rather than the dependency injection not working as expected...?
Workaround
The current workaround for this issue is to get the dependency from
CoreRegistry
instead:This workaround gets applied to all behavior actions in
Behaviors
in Terasology/Behaviors#102Additional notes
Related Issues:
The text was updated successfully, but these errors were encountered: