This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248245 - Unexpected warning message when using a public static field in a managed bean.
Summary: Unexpected warning message when using a public static field in a managed bean.
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-29 12:25 UTC by sentrox
Modified: 2015-06-11 02:39 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
editor screenshot (14.61 KB, image/png)
2014-10-29 12:25 UTC, sentrox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sentrox 2014-10-29 12:25:09 UTC
Created attachment 150152 [details]
editor screenshot

How to reproduce:

- Create a new managed bean using @ApplicationScope annotation
- Declare a public constant inside the bean

Unexepected result:

- A warning message is shown "A managed bean with a public field ("FIELDNAME") should not declare any scope other than @Dependent"

Expected result:

- No error message, as CDI-Spec v1.2 states:

<snip>
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.
...
<snap>
Comment 1 Sergey Petrov 2014-10-29 12:35:02 UTC
in general constant is not the same as static, but I suppose you mean final static
Comment 2 sentrox 2014-10-29 13:35:54 UTC
(In reply to Sergey Petrov from comment #1)
> in general constant is not the same as static, but I suppose you mean final
> static

Yes, I've meant "static final". Anyway if the public field is static no error message should be displayed.
Comment 3 Petr Hejl 2015-06-09 10:57:20 UTC
Fixed in web-main 050336bc234d.
Comment 4 Quality Engineering 2015-06-11 02:39:42 UTC
Integrated into 'main-silver', will be available in build *201506110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/050336bc234d
User: Petr Hejl <phejl@netbeans.org>
Log: #248245 - Unexpected warning message when using a public static field in a managed bean.