Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 478603

Summary: Use @NonNull and @Nullable annotations for IWorkbench API
Product: [Eclipse Project] Platform Reporter: Lars Vogel <Lars.Vogel>
Component: UIAssignee: Brian de Alwis <bsd>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, Lars.Vogel, loskutov, stephan.herrmann
Version: 4.5   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/62344
https://bugs.eclipse.org/bugs/show_bug.cgi?id=472631
https://bugs.eclipse.org/bugs/show_bug.cgi?id=540433
Whiteboard:

Description Lars Vogel CLA 2015-09-29 04:38:25 EDT
Even experience Eclipse developers make the error not checking for null in IWorkbench API.

https://git.eclipse.org/r/#/c/50042/7/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/AbstractZoomTextHandler.java

We should use @NotNullable for this API. @NotNullable
Comment 1 Andrey Loskutov CLA 2015-09-29 04:42:38 EDT
(In reply to Lars Vogel from comment #0)
> We should use @NotNullable for this API. @NotNullable

? Are you proposing new API to replace org.eclipse.jdt.annotation.NonNull, see 
https://wiki.eclipse.org/JDT_Core/Null_Analysis?

Why not just use existing one? The (hidden) reason is: FindBugs also understands org.eclipse.jdt.annotation.NonNull but it will not understand some custom NotNullable annotation.
Comment 2 Lars Vogel CLA 2015-09-29 04:51:07 EDT
(In reply to Andrey Loskutov from comment #1)
> (In reply to Lars Vogel from comment #0)
> > We should use @NotNullable for this API. @NotNullable
> 
> ? Are you proposing new API to replace org.eclipse.jdt.annotation.NonNull

No plan to introduce new API. I was planning to use the JDT annotations, just mistyped them as I did not remember there they are documented. Thanks for the pointer to the wiki.
Comment 3 Stephan Herrmann CLA 2015-09-29 07:58:00 EDT
(In reply to Lars Vogel from comment #2)
> [...] I did not remember there they are documented. Thanks
> for the pointer to the wiki.

See also bug 472631 comment 12
(official documentation is in the help)
Comment 4 Eclipse Genie CLA 2015-12-09 15:07:10 EST
New Gerrit change created: https://git.eclipse.org/r/62344
Comment 5 Lars Vogel CLA 2015-12-09 16:09:38 EST
I think we should first enable the Null analysis in our plug-ins before merging this change. See Bug 472631.
Comment 6 Lars Vogel CLA 2016-01-25 04:55:13 EST
Mass move to M6
Comment 7 Lars Vogel CLA 2016-09-13 03:58:50 EDT
Can this be done for M3?
Comment 8 Brian de Alwis CLA 2016-09-13 05:34:47 EDT
Yes! I'll announce on platform-ui-dev after M2.
Comment 9 Lars Vogel CLA 2016-10-31 12:12:51 EDT
Mass move to M4.
Comment 10 Brian de Alwis CLA 2017-05-25 09:44:24 EDT
This was more difficult than I imagined as we have some inconsistent code ourselves.

I'm going to take a different approach and start at JFace and move up with a series of commits.
Comment 11 Lars Vogel CLA 2019-04-24 07:59:10 EDT
(In reply to Brian de Alwis from comment #10)
> This was more difficult than I imagined as we have some inconsistent code
> ourselves.
> 
> I'm going to take a different approach and start at JFace and move up with a
> series of commits.

First usage was done via Bug 540433.
Comment 12 Lars Vogel CLA 2020-11-17 04:56:37 EST
Please reopen if you plan to work on this.