Bug 365764 - [compiler][null] validate configured null annotation types
Summary: [compiler][null] validate configured null annotation types
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: Other Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-06 11:27 EST by Stephan Herrmann CLA
Modified: 2020-03-28 14:31 EDT (History)
4 users (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 2011-12-06 11:27:17 EST
from bug 364815 comment #17:

> More generally: in the core we decided to not perform any lookup of
> configured annotation types before they are actually used in the code.
> 
> Since the UI doesn't do any validation either (I understand this would only
> work on the project level) users can now break null-analysis by a simple
> typo in the preferences without being alerted.
> 
> Maybe we should rethink responsibility for a desirable validation here.
> Unqualified names are really just a special case that was relevant for the
> implementation at some point but doesn't require special treatment any longer.
> The problem is: user specifies in the preferences: org.mycomp.Nonnull and 
> writes code using @org.mycomp.NonNull and still gets no errors/warnings.

Initial idea: maybe we can lookup/check annotation types on each
full build while keeping the lazy strategy for incremental builds.

In that case we'd need to make errors against that configuration
distinguishable from normal compiler errors to avoid their deletion
during incremental build.
Comment 1 Markus Keller CLA 2011-12-06 14:52:51 EST
I think we also have to revisit the JavaCore.COMPILER_*_ANNOTATION_NAME options. The current API doesn't allow using only one of the nullness annotations, but NonNullByDefault may not even be supported by all sets of nullness annotations. The APIs should also allow the empty string if the given annotation kind is not used.
Comment 2 Stephan Herrmann CLA 2011-12-06 15:40:04 EST
(In reply to comment #1)
> I think we also have to revisit the JavaCore.COMPILER_*_ANNOTATION_NAME
> options. The current API doesn't allow using only one of the nullness
> annotations, but NonNullByDefault may not even be supported by all sets of
> nullness annotations. The APIs should also allow the empty string if the given
> annotation kind is not used.

For NonNullByDefault I definitely agree. 
Currently, any string that doesn't match an existing annotation type 
would do, but if we start validating the string, users must be able to
explicitly opt-out.

Doing without NonNull or Nullable looks less useful to me.
I haven't seen a set of null annotations without either of these.

The implementation actually requires NonNull to exist, currently.
Comment 3 Ayushman Jain CLA 2011-12-07 03:48:28 EST
We should also make sure the same annotation is not used for two different purposes i.e. if @NonNull is used as both non-null and non-null-by-default annotaion, the UI dialog should give an error.
Comment 4 Eclipse Genie CLA 2020-03-28 14:31:27 EDT
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.