Bug 530305 - [null] consider opening @NonNullByDefault to all default target positions
Summary: [null] consider opening @NonNullByDefault to all default target positions
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 4.8 M6   Edit
Assignee: Till Brychcy CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on: 530913
Blocks: 531990
  Show dependency tree
 
Reported: 2018-01-25 08:03 EST by Stephan Herrmann CLA
Modified: 2018-03-07 05:24 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2018-01-25 08:03:59 EST
(In reply to Till Brychcy from bug 507109 comment #23)
> Great!
> 
> What about simply releasing a @NonNullByDefault without @Target, so we can
> avoid the requirement that ElementType.MODULE exists?
> 
> According to JLS9:
> 
> "If an annotation of type java.lang.annotation.Target is not present on the
> declaration of an annotation type T, then T is applicable in all declaration
> contexts except type parameter declarations, and in no type contexts."
> 
> Comparing this with the Targets of the current @NonNullByDefault, and with 
> ANNOTATION_TYPE being included in TYPE, the only unimplemented values is
> PARAMETER. We could create a ticket for that - LOCAL_VARIABLE and FIELD were
> also initially unimplemented...
Comment 1 Till Brychcy CLA 2018-02-08 15:34:33 EST
Actually ALL LEGAL Target positions would include TYPE_USE and TYPE_PARAMETER, but these are not allowed if no @Target is specified for an annotation and I don't think implementing @NonNullByDefault for them is useful.

Maybe the title should be "...to all default target positions"?
Comment 2 Eclipse Genie CLA 2018-02-28 14:25:40 EST
New Gerrit change created: https://git.eclipse.org/r/118373
Comment 3 Till Brychcy CLA 2018-02-28 14:29:07 EST
Bug 530913 has implemented @Target(Parameter) so we even can do this with a good conscience ;-)

(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/118373

I've prepared a patch that removes the @Target annotation from NonNullByDefault

I've increased the version to 2.2.0, but needed an api filter as the annotation change is not detected.

@Stephan, can you have a look?
Comment 4 Stephan Herrmann CLA 2018-03-04 13:18:16 EST
bulk move to 4.8 M7
Comment 5 Till Brychcy CLA 2018-03-04 13:24:25 EST
Stephan, any objections to releasing the gerrit?
Comment 6 Stephan Herrmann CLA 2018-03-04 14:19:52 EST
(In reply to Till Brychcy from comment #5)
> Stephan, any objections to releasing the gerrit?

No objection :)
Comment 8 Till Brychcy CLA 2018-03-04 16:11:39 EST
(In reply to Eclipse Genie from comment #7)
> Gerrit change https://git.eclipse.org/r/118373 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=b8d7a12775594ef356756c44e2a3778362907791

Released for 4.8M6
Comment 9 Eclipse Genie CLA 2018-03-05 14:49:44 EST
New Gerrit change created: https://git.eclipse.org/r/118712
Comment 11 Till Brychcy CLA 2018-03-05 14:54:57 EST
(In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/118712 was merged to [master].
> Commit:
> http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/
> ?id=a1ed0c7002d5238ab2e53e50a59da9abe1e23753

@Stephan, I'd be happy if you have a look at the whole @NonNullByDefault-section of the N&N entry - I'm not sure if everything is understandable.
In case you have improvement ideas just go ahead (even if you scrap my whole text), you just a way better writer than I am.
Comment 12 Stephan Herrmann CLA 2018-03-06 11:45:16 EST
(In reply to Till Brychcy from comment #11)
> (In reply to Eclipse Genie from comment #10)
> > Gerrit change https://git.eclipse.org/r/118712 was merged to [master].
> > Commit:
> > http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/
> > ?id=a1ed0c7002d5238ab2e53e50a59da9abe1e23753
> 
> @Stephan, I'd be happy if you have a look at the whole
> @NonNullByDefault-section of the N&N entry - I'm not sure if everything is
> understandable.
> In case you have improvement ideas just go ahead (even if you scrap my whole
> text), you just a way better writer than I am.

I'm sorry I couldn't participate in the implementation of all this, but used the opportunity to at least *read* about the achievements :)

Looks great, just made a few editorial changes here and there (incl. a bunch of links).

We are still not exactly following the suggestion to use active voice ("you can now"  vs. "has been implemented"), but I left this as is, just s.t. to perhaps keep in mind for next time :)
Comment 13 Till Brychcy CLA 2018-03-06 14:20:17 EST
(In reply to Stephan Herrmann from comment #12)
> (In reply to Till Brychcy from comment #11)
> > (In reply to Eclipse Genie from comment #10)
> > > Gerrit change https://git.eclipse.org/r/118712 was merged to [master].
> > > Commit:
> > > http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/
> > > ?id=a1ed0c7002d5238ab2e53e50a59da9abe1e23753
> > 
> > @Stephan, I'd be happy if you have a look at the whole
> > @NonNullByDefault-section of the N&N entry - I'm not sure if everything is
> > understandable.
> > In case you have improvement ideas just go ahead (even if you scrap my whole
> > text), you just a way better writer than I am.
> 
> I'm sorry I couldn't participate in the implementation of all this, but used
> the opportunity to at least *read* about the achievements :)
> 
> Looks great, just made a few editorial changes here and there (incl. a bunch
> of links).
> 
> We are still not exactly following the suggestion to use active voice ("you
> can now"  vs. "has been implemented"), but I left this as is, just s.t. to
> perhaps keep in mind for next time :)

Thanks for the improvements! While reading thru your improved version I noted that it isn't mentioned that all target positions are now also supported with declaration annotations (possibly useful: module declaration, local variable and field) and then I thought: should we also release an updated bundle for declaration annotations, or maybe  give an example how to define custom annotations (e.g. point out that the package and type names don't matter, just the annotation value names)?
Comment 14 Manoj N Palat CLA 2018-03-07 05:24:16 EST
Verified for Eclipse Photon (4.8) M6 with Build id: I20180306-0800