This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250702 - Add support for package null-check annotations
Summary: Add support for package null-check annotations
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks: 249320
  Show dependency tree
 
Reported: 2015-02-25 17:02 UTC by yastrebov
Modified: 2015-10-02 14:53 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Package wise null-check annotations support (7.07 KB, patch)
2015-02-25 17:02 UTC, yastrebov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yastrebov 2015-02-25 17:02:02 UTC
Created attachment 152221 [details]
Package wise null-check annotations support

Patch provides support for the following null-check related package annotations:

@ParametersAreNonnullByDefault
@ParametersAreNullableByDefault

@ReturnValuesAreNonnullByDefault
@ReturnTypesAreNonnullByDefault
Comment 1 Ralph Ruijs 2015-03-08 12:45:07 UTC
My first thought was, why not reuse the existing @NonNull and @Nullable. But after giving it some more thought, is this something we should add/use? Why not add the annotations to the element directly? Is there some paper recommending @NonNull and @Nullable on package level?
Comment 2 yastrebov 2015-03-08 20:53:16 UTC
(In reply to Ralph Ruijs from comment #1)
> My first thought was, why not reuse the existing @NonNull and @Nullable. But
> after giving it some more thought, is this something we should add/use? Why
> not add the annotations to the element directly? Is there some paper
> recommending @NonNull and @Nullable on package level?

That is the point - element-wise (ie parameter, variable, field) annotations ARE supported since 7.3 or earlier.
This patch provides support for package level annotations, so you can define default null policy for package. This is already supported by Ecliple and IDEA.

See:
http://wiki.eclipse.org/JDT_Core/Null_Analysis
http://blog.scottlogic.com/2013/09/09/nullable-in-kepler.html
https://www.jetbrains.com/idea/help/-parametersarenonnullbydefault-annotation.html
[in russian] http://habrahabr.ru/post/204518/
Comment 3 Svata Dedic 2015-10-02 14:53:45 UTC
Will evaluate.