-
Clarification
-
Resolution: Done
-
Major
-
None
-
None
-
None
See 3.1. Managed beans:
If a managed bean has a public field, it must have scope @Dependent. If a managed bean with a public field declares any scope other than @Dependent, the container automatically detects the problem and treats it as a definition error.
I see no reason why to disallow public static fields on normal scoped beans. To treat public non-static fields as a definition error due to proxy generation is reasonable. However public static fields are usually referenced by the class name and refering to static fields with an object reference (proxy in this case) is discouraged. Moreover, protected and package-private fields which might also cause confusion around proxies are allowed.
BTW Weld allows public static fields on normal scoped beans at the moment.
Maybe the spec wording could be:
3.1. Managed beans
If a managed bean has a non-static public field, it must have scope @Dependent. If a managed bean with a non-static public field declares any scope other than @Dependent, the container automatically detects the problem and treats it as a definition error.