Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dependency Injection Support for Behavior Actions #5004

Open
jdrueckert opened this issue Apr 2, 2022 · 0 comments
Open

Fix Dependency Injection Support for Behavior Actions #5004

jdrueckert opened this issue Apr 2, 2022 · 0 comments
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

Comments

@jdrueckert
Copy link
Member

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:

nightTrackerSystem = CoreRegistry.get(NightTrackerSystem.class);

This workaround gets applied to all behavior actions in Behaviors in Terasology/Behaviors#102

Additional notes

Related Issues:

@jdrueckert jdrueckert added Type: Bug Issues reporting and PRs fixing problems 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 labels Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant