Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-01-21 19:35:01 +0000
committerStephan Herrmann2012-01-21 19:35:01 +0000
commitbd0edd7688142c1743cb6b10766dfc576040f113 (patch)
tree4e100df81a3231aa51b88ef998baa8c34b8f04d3 /org.eclipse.jdt.annotation/src
parent8c93d4e99b8a943865cb7391e781eba5bb83dfc9 (diff)
downloadeclipse.jdt.core-bd0edd7688142c1743cb6b10766dfc576040f113.tar.gz
eclipse.jdt.core-bd0edd7688142c1743cb6b10766dfc576040f113.tar.xz
eclipse.jdt.core-bd0edd7688142c1743cb6b10766dfc576040f113.zip
Initial implementation for Bug 331649:
[compiler][null] consider null annotations for fields
Diffstat (limited to 'org.eclipse.jdt.annotation/src')
-rw-r--r--org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java7
-rw-r--r--org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java7
2 files changed, 8 insertions, 6 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 93727394bb..36ec3ae25c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Stephan Herrmann and others.
+ * Copyright (c) 2011, 2012 Stephan Herrmann and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
*******************************************************************************/
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;
@@ -22,7 +23,7 @@ import java.lang.annotation.Target;
/**
* Qualifier for a type in a method signature or a local variable declaration:
- * The entity (return value, parameter, local variable) whose type has this
+ * The entity (return value, parameter, field, local variable) whose type has this
* annotation can never have the value <code>null</code> at runtime.
* <p>
* This has two consequences:
@@ -44,7 +45,7 @@ import java.lang.annotation.Target;
*/
@Documented
@Retention(RetentionPolicy.CLASS)
-@Target({ METHOD, PARAMETER, LOCAL_VARIABLE })
+@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE })
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 41f93cd75a..cb84e4540b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Stephan Herrmann and others.
+ * Copyright (c) 2011, 2012 Stephan Herrmann and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
*******************************************************************************/
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;
@@ -22,7 +23,7 @@ import java.lang.annotation.Target;
/**
* Qualifier for a type in a method signature or a local variable declaration:
- * The entity (return value, parameter, local variable) whose type has this
+ * The entity (return value, parameter, field, local variable) whose type has this
* annotation is allowed to have the value <code>null</code> at runtime.
* <p>
* This has two consequences:
@@ -35,7 +36,7 @@ import java.lang.annotation.Target;
*/
@Documented
@Retention(RetentionPolicy.CLASS)
-@Target({ METHOD, PARAMETER, LOCAL_VARIABLE })
+@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE })
public @interface Nullable {
// marker annotation with no members
} \ No newline at end of file

Back to the top