Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2013-08-15 16:54:38 +0000
committerStephan Herrmann2013-08-15 16:54:38 +0000
commit6e45c3b12d66a6d00320490b98ad7820ecc63934 (patch)
tree006bc4de3cb96b53579683e4d73b6662b193dd28 /org.eclipse.jdt.annotation/src/org/eclipse/jdt
parent49894ec43e425d82d6841fb37405b9e39799b63c (diff)
downloadeclipse.jdt.core-6e45c3b12d66a6d00320490b98ad7820ecc63934.tar.gz
eclipse.jdt.core-6e45c3b12d66a6d00320490b98ad7820ecc63934.tar.xz
eclipse.jdt.core-6e45c3b12d66a6d00320490b98ad7820ecc63934.zip
Bug 414444 - [1.8][null] Configure null annotation bundle for 1.8
(TYPE_USE) - split annotation bundle, but cannot yet use BREE JavaSE-1.8
Diffstat (limited to 'org.eclipse.jdt.annotation/src/org/eclipse/jdt')
-rw-r--r--org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java23
-rw-r--r--org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java27
2 files changed, 26 insertions, 24 deletions
diff --git a/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java b/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java
index 047409d3ed..4ed4d3bdbf 100644
--- a/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java
+++ b/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java
@@ -5,16 +5,17 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* Stephan Herrmann - initial API and implementation
* IBM Corporation - bug fixes
*******************************************************************************/
package org.eclipse.jdt.annotation;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE_USE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
@@ -22,14 +23,14 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Qualifier for a type in a method signature or a local variable declaration:
- * The entity (return value, parameter, field, local variable) whose type has this
- * annotation can never have the value <code>null</code> at runtime.
+ * Qualifier for a reference type in a {@link TYPE_USE} position:
+ * The type that has this annotation is intended to not include the value <code>null</code>.
* <p>
- * This has two consequences:
+ * If annotation based null analysis is enabled using this annotation has two consequences:
* <ol>
- * <li>Dereferencing the entity is safe, i.e., no <code>NullPointerException</code> can occur at runtime.</li>
- * <li>An attempt to bind a <code>null</code> value to the entity is a compile time error.</li>
+ * <li>Dereferencing an expression of this type is safe, i.e., no <code>NullPointerException</code> can occur at runtime.</li>
+ * <li>An attempt to bind a <code>null</code> value to an entity (field, local variable, method parameter or method return value)
+ * of this type is a compile time error.</li>
* </ol>
* For the second case, diagnostics issued by the compiler should distinguish three situations:
* <ol>
@@ -45,7 +46,7 @@ import java.lang.annotation.Target;
*/
@Documented
@Retention(RetentionPolicy.CLASS)
-@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE })
+@Target({ TYPE_USE })
public @interface NonNull {
// marker annotation with no members
}
diff --git a/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java b/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java
index 68d6f53fb1..1929b0768e 100644
--- a/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java
+++ b/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java
@@ -5,16 +5,17 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* Stephan Herrmann - initial API and implementation
* IBM Corporation - bug fixes
*******************************************************************************/
package org.eclipse.jdt.annotation;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE_USE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
@@ -22,21 +23,21 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Qualifier for a type in a method signature or a local variable declaration:
- * The entity (return value, parameter, field, local variable) whose type has this
- * annotation is allowed to have the value <code>null</code> at runtime.
+ * Qualifier for a reference type in a {@link TYPE_USE} position:
+ * The type that has this annotation explicitly includes the value <code>null</code>.
* <p>
- * This has two consequences:
- * <ul>
- * <li>Binding a <code>null</code> value to the entity is legal.</li>
- * <li>Dereferencing the entity is unsafe, i.e., a <code>NullPointerException</code> can occur at runtime.</li>
- * </ul>
+ * If annotation based null analysis is enabled using this annotation has two consequences:
+ * <ol>
+ * <li>Binding a <code>null</code> value to an entity (field, local variable, method parameter or method return value)
+ * of this type is legal.</li>
+ * <li>Dereferencing an expression of this type is unsafe, i.e., a <code>NullPointerException</code> can occur at runtime.</li>
+ * </ol>
* </p>
* @since 1.0
*/
@Documented
@Retention(RetentionPolicy.CLASS)
-@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE })
+@Target({ TYPE_USE })
public @interface Nullable {
// marker annotation with no members
} \ No newline at end of file

Back to the top