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

Clarify that WeldInitiator.from() and WeldInitiator.of() should use the same variable scope #168

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

manovotn
Copy link
Collaborator

Fixes #167

While we cannot enforce this, we should still mention it as it's not very clear to users.
While keeping partly configured Weld instance in a static field, having WeldInitiator in non-static variable means that another layer of configuration is being applied to the same Weld instance for each test method in that given class.
This leads to some unexpected and hard-to-debug scenarios.

@manovotn manovotn requested a review from mkouba January 30, 2024 13:17
*
* @param weld
* @param weld instance of {@link Weld} used to create {@link WeldInitiator}
* @return a new WeldInitiator instance
*/
public static WeldInitiator of(Weld weld) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, this method shouldn't exhibit the problem as it returns WeldInitiator directly instead of returning a still-configurable Builder object but I added it here anyway for the sake of consistency.

@manovotn manovotn merged commit 7c79b90 into weld:master Jan 30, 2024
2 checks passed
@manovotn manovotn deleted the issue167 branch January 30, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lost active contexts when using static weld
2 participants