| Summary: | [compiler][null] nullability annotation with arrays results in unavoidable warning. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Sergey Olefir <solf.gm> | ||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | stephan.herrmann | ||||
| Version: | 4.5.1 | ||||||
| Target Milestone: | 4.6 M3 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Thanks, I can reproduce in 4.5.1. Starting with 4.6M3 the variant *with* @NonNull on the field declaration (affecting the array element type) is accepted with no error/warning. *** This bug has been marked as a duplicate of bug 467094 *** |
Created attachment 258815 [details] Eclipse project demonstrating the problem In a fairly straightforward case of trying to declare array without null elements compiler appears to get confused -- you get the choice of either 'redundant nullness annotation' or 'unchecked conversion to @Nonnull' -- appears impossible to actually fix it so there's no warning. Steps: Eclipse eclipse-jee-mars-1-win32-x86_64.zip Help->About: Version: Mars.1 Release (4.5.1) Build id: 20150924-1200 JDT core org.eclipse.jdt.core_3.11.1.v20150902-1521.jar java -version java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode) Project is attached with all relevant settings set at project level. Use "Import existing project into workspace" functionality. See ArrayNullabilityBug.java (in case no warnings are reported, make trivial change (e.g. add space) and re-save).