| Summary: | Annotation-based null analysis adds @NonNull | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Steffen Brüntjen <steffen> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows NT | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
In my Eclipse Neon workspace settings i checked [x] Enable annotation-based null analysis. Now when I'm doing Assign statement to new variable from quick assist, Eclipse sometimes adds @NonNull to the new variable assigment. So intead of line 1, I get line 2: Deprecated a = Main.class.getAnnotation(Deprecated.class); // line 1 @NonNull Deprecated a = Main.class.getAnnotation(Deprecated.class); // line 2 This raises two questions: 1. How can I enable and disable this behaviour? In a second project within the same workspace Eclipse doesn't to this. So it doesn't only depend on the annotation-based null analysis which was configured in the workspace settings. 2. Why does Eclipse conclude annotation is @NonNull while the return value can be clearly be null (by documentation): Annotation Class.getAnnotation(java.lang.Class annotationClass) Returns this element's annotation for the specified type if such an annotation is present, else null. See also https://stackoverflow.com/questions/37412554/eclipse-neon-quick-assist-automatically-adds-nonnull