Bug 459180 - [1.8][null] Document the ability to override a type parameter's nullness at the use site
Summary: [1.8][null] Document the ability to override a type parameter's nullness at t...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Doc (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 4.5 RC4   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2015-02-04 18:14 EST by Stephan Herrmann CLA
Modified: 2015-06-02 06:26 EDT (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 2015-02-04 18:14:39 EST
In the help [1] I describe how null annotations at a type parameter affect the type variable (usage). From this explanation it is not obvious that this nullness can be overridden at each usage of the type variable, like:

interface I1 <T extends @NonNull Object> {
   @Nullable T maybeGet();
}

interface I2 <@Nullable T> {
   @NonNull T getNonNull();
}

A paragraph should be added to make this fact better known.

Additionally, this sentence from the javadoc of DefaultLocation should be made more prominent:

"Wildcards and the use of type variables are always excluded from {@link NonNullByDefault}."

[1] http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_null_type_annotations.htm&cp=1_3_9_1_0_0&anchor=typeVariables