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

Relax the scope requirement for public fields #698

Merged
merged 1 commit into from Nov 8, 2023

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Nov 7, 2023

Currently, the specification says that non-@Dependent beans may not have public fields. This is overly restrictive; in particular, implementing this rule precisely precludes passing the AtInject TCK, where @Singleton beans have public fields.

This commit relaxes the requirement: all pseudo-scoped beans may have public fields; normal scoped beans may not. This makes most sense, it is what all existing implementations do (checked ArC, Weld and OpenWebBeans) and it is how the TCK is already written.

Fixes #660

@Ladicek Ladicek added this to the CDI 4.1 milestone Nov 7, 2023
@Ladicek Ladicek requested a review from manovotn November 7, 2023 16:00
@Ladicek Ladicek force-pushed the public-fields-scope-requirement branch from 5bf162e to af87280 Compare November 7, 2023 16:04
@Ladicek Ladicek changed the title Relax the scope requirement on pseudo-scoped beans Relax the scope requirement for public fields Nov 7, 2023
Currently, the specification says that non-`@Dependent` beans may not have
public fields. This is overly restrictive; in particular, implementing this
rule precisely precludes passing the AtInject TCK, where `@Singleton` beans
have public fields.

This commit relaxes the requirement: all pseudo-scoped beans may have public
fields; normal scoped beans may not. This makes most sense, it is what all
existing implementations do (checked ArC, Weld and OpenWebBeans) and it is
how the TCK is already written.
@Ladicek Ladicek force-pushed the public-fields-scope-requirement branch from af87280 to db43b35 Compare November 8, 2023 06:57
@Ladicek Ladicek merged commit 3855bf0 into jakartaee:main Nov 8, 2023
2 checks passed
@Ladicek Ladicek deleted the public-fields-scope-requirement branch November 8, 2023 11:32
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.

Improve wording of managed bean requirements WRT non-static public fields
3 participants