aboutsummaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-05-30 14:54:39 -0700
committerTor Norbye <tnorbye@google.com>2012-05-30 17:25:18 -0700
commit7e4b8e9d595e45baa9d87cdb8282f02759e73abc (patch)
tree2da5fccd6c1e00c972c69323e3cf10df2e5ab264 /common/src
parent5ee7da2ae31dcbe781ed81c07f31b31d0a0a7d7f (diff)
downloadsdk-7e4b8e9d595e45baa9d87cdb8282f02759e73abc.zip
sdk-7e4b8e9d595e45baa9d87cdb8282f02759e73abc.tar.gz
sdk-7e4b8e9d595e45baa9d87cdb8282f02759e73abc.tar.bz2
Fix nullness annotations
Eclipse 4.2 includes analysis support for @Nullable and @NonNull annotations. However, it requires these annotations to be *repeated* on every single method implementing or overriding a superclass or interface method (!). This changeset basically applies the quickfixes to inline these annotations. It also changes the retention of our nullness annotations from source to class, since without this Eclipse believes that a @NonNull annotation downstream is a redefinition of a @Nullable annotation. Finally, the null analysis revealed a dozen or so places where the nullness annotation was either wrong, or some null checking on parameters or return values needed to be done. Change-Id: I43b4e56e2d025a8a4c92a8873f55c13cdbc4c1cb
Diffstat (limited to 'common/src')
-rw-r--r--common/src/com/android/annotations/NonNull.java2
-rw-r--r--common/src/com/android/annotations/NonNullByDefault.java2
-rwxr-xr-xcommon/src/com/android/annotations/Nullable.java2
-rw-r--r--common/src/com/android/util/PositionXmlParser.java2
4 files changed, 4 insertions, 4 deletions
diff --git a/common/src/com/android/annotations/NonNull.java b/common/src/com/android/annotations/NonNull.java
index e306a31..973ebb6 100644
--- a/common/src/com/android/annotations/NonNull.java
+++ b/common/src/com/android/annotations/NonNull.java
@@ -32,7 +32,7 @@ import java.lang.annotation.Target;
* This is a marker annotation and it has no specific attributes.
*/
@Documented
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.CLASS)
@Target({METHOD,PARAMETER,LOCAL_VARIABLE,FIELD})
public @interface NonNull {
}
diff --git a/common/src/com/android/annotations/NonNullByDefault.java b/common/src/com/android/annotations/NonNullByDefault.java
index 23903d1..3db891c 100644
--- a/common/src/com/android/annotations/NonNullByDefault.java
+++ b/common/src/com/android/annotations/NonNullByDefault.java
@@ -41,7 +41,7 @@ import java.lang.annotation.Target;
* This is a marker annotation and it has no specific attributes.
*/
@Documented
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.CLASS)
@Target({PACKAGE, TYPE})
public @interface NonNullByDefault {
}
diff --git a/common/src/com/android/annotations/Nullable.java b/common/src/com/android/annotations/Nullable.java
index 376c1f6..d9c3861 100755
--- a/common/src/com/android/annotations/Nullable.java
+++ b/common/src/com/android/annotations/Nullable.java
@@ -43,7 +43,7 @@ import java.lang.annotation.Target;
* This is a marker annotation and it has no specific attributes.
*/
@Documented
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.CLASS)
@Target({METHOD, PARAMETER, LOCAL_VARIABLE, FIELD})
public @interface Nullable {
}
diff --git a/common/src/com/android/util/PositionXmlParser.java b/common/src/com/android/util/PositionXmlParser.java
index 052348d..6eee96f 100644
--- a/common/src/com/android/util/PositionXmlParser.java
+++ b/common/src/com/android/util/PositionXmlParser.java
@@ -677,7 +677,7 @@ public class PositionXmlParser {
}
@Override
- public void setEnd(Position end) {
+ public void setEnd(@NonNull Position end) {
mEnd = end;
}
}