aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-04-11 14:18:25 -0700
committerColin Cross <ccross@android.com>2019-04-11 15:17:02 -0700
commitdc6f1c2dc100ef77e4df17d6e11c49ab34672f15 (patch)
tree348d1813c5c481be25bd52102e733079bd2e4d89
parentca386f40b0f3c8b7b9b9e4e69e366218d65dc227 (diff)
downloadguava-dc6f1c2dc100ef77e4df17d6e11c49ab34672f15.tar.gz
Update Android.bp to compile guava 27.1
Adds android-annotation-stubs to provide RetentionPolicy(SOURCE) annotations for everything that doesn't exist in the Android tree. Bug: 130306229 Test: m checkbuild Change-Id: Iba30993c65ec038faba278df1bd5b438602191b4
-rw-r--r--Android.bp63
-rwxr-xr-xandroid-annotation-stubs/gen_annotations.sh42
-rw-r--r--android-annotation-stubs/src/com/google/j2objc/annotations/J2ObjCIncompatible.java36
-rw-r--r--android-annotation-stubs/src/com/google/j2objc/annotations/ReflectionSupport.java42
-rw-r--r--android-annotation-stubs/src/com/google/j2objc/annotations/RetainedWith.java36
-rw-r--r--android-annotation-stubs/src/com/google/j2objc/annotations/Weak.java36
-rw-r--r--android-annotation-stubs/src/com/google/j2objc/annotations/WeakOuter.java36
-rw-r--r--android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/MonotonicNonNullDecl.java36
-rw-r--r--android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NonNullDecl.java36
-rw-r--r--android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NullableDecl.java36
-rw-r--r--android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java36
-rw-r--r--android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/NonNull.java36
-rw-r--r--android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java36
-rw-r--r--android-annotation-stubs/src/org/codehaus/mojo/animal_sniffer/IgnoreJRERequirement.java36
-rw-r--r--android-annotation-stubs/tmpl.java39
15 files changed, 579 insertions, 3 deletions
diff --git a/Android.bp b/Android.bp
index f5108e516..fbdc10f93 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12,14 +12,62 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-java_library_static {
+java_library {
name: "guava",
host_supported: true,
hostdex: true,
sdk_version: "core_current",
- srcs: ["guava/src/**/*.java"],
+ target: {
+ android: {
+ static_libs: ["guava-android"],
+ },
+ host: {
+ static_libs: ["guava-jre"],
+ },
+ },
+}
+
+java_library {
+ name: "guava-both",
+ host_supported: true,
+ sdk_version: "core_current",
+ srcs: ["futures/failureaccess/**/*.java"],
static_libs: ["jsr305"],
- java_version: "1.7",
+ libs: [
+ "guava-android-annotation-stubs",
+ "error_prone_annotations",
+ ],
+ java_version: "1.8",
+}
+
+java_library_host {
+ name: "guava-jre",
+ srcs: ["guava/src/**/*.java"],
+ static_libs: ["guava-both"],
+ libs: [
+ "guava-android-annotation-stubs",
+ "error_prone_annotations",
+ ],
+ java_version: "1.8",
+}
+
+// Guava for Android can't compile against an Android bootclasspath, compile
+// it for the host and then use it on the device. It uses reflection to
+// prevent calling into methods that don't exist on Android.
+java_library_host {
+ name: "guava-android-host",
+ srcs: ["android/guava/src/**/*.java"],
+ static_libs: ["guava-both"],
+ libs: [
+ "guava-android-annotation-stubs",
+ "error_prone_annotations",
+ ],
+ java_version: "1.8",
+}
+
+java_host_for_device {
+ name: "guava-android",
+ libs: ["guava-android-host"],
}
// Compatibility name for existing host modules
@@ -27,3 +75,12 @@ java_library_host {
name: "guavalib",
static_libs: ["guava"],
}
+
+// Compile dummy implementations of annotations used by guava but not
+// present in the Android tree.
+java_library {
+ name: "guava-android-annotation-stubs",
+ host_supported: true,
+ sdk_version: "core_current",
+ srcs: ["android-annotation-stubs/src/**/*.java"],
+}
diff --git a/android-annotation-stubs/gen_annotations.sh b/android-annotation-stubs/gen_annotations.sh
new file mode 100755
index 000000000..82c06b166
--- /dev/null
+++ b/android-annotation-stubs/gen_annotations.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+ANNOTATIONS=(
+ org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl
+ org.checkerframework.checker.nullness.compatqual.NullableDecl
+ org.checkerframework.checker.nullness.compatqual.NonNullDecl
+ org.checkerframework.checker.nullness.qual.NonNull
+ org.checkerframework.checker.nullness.qual.Nullable
+ org.checkerframework.checker.nullness.qual.MonotonicNonNull
+ org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
+ com.google.j2objc.annotations.J2ObjCIncompatible
+ com.google.j2objc.annotations.WeakOuter
+ com.google.j2objc.annotations.Weak
+ com.google.j2objc.annotations.ReflectionSupport
+ com.google.j2objc.annotations.RetainedWith
+)
+
+for a in ${ANNOTATIONS[@]}; do
+ package=${a%.*}
+ class=${a##*.}
+ dir=$(dirname $0)/src/${package//.//}
+ file=${class}.java
+
+ mkdir -p ${dir}
+ sed -e"s/__PACKAGE__/${package}/" -e"s/__CLASS__/${class}/" tmpl.java > ${dir}/${file}
+done
+
+f=$(dirname $0)/src/com/google/j2objc/annotations/ReflectionSupport.java
+head -n-1 ${f} > ${f}.tmp
+
+cat >> ${f}.tmp <<EOF
+public @interface ReflectionSupport {
+ enum Level {
+ FULL
+ }
+
+ Level value();
+}
+EOF
+
+mv ${f}.tmp ${f}
+
diff --git a/android-annotation-stubs/src/com/google/j2objc/annotations/J2ObjCIncompatible.java b/android-annotation-stubs/src/com/google/j2objc/annotations/J2ObjCIncompatible.java
new file mode 100644
index 000000000..c1aae5280
--- /dev/null
+++ b/android-annotation-stubs/src/com/google/j2objc/annotations/J2ObjCIncompatible.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.j2objc.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface J2ObjCIncompatible {}
diff --git a/android-annotation-stubs/src/com/google/j2objc/annotations/ReflectionSupport.java b/android-annotation-stubs/src/com/google/j2objc/annotations/ReflectionSupport.java
new file mode 100644
index 000000000..985dd4578
--- /dev/null
+++ b/android-annotation-stubs/src/com/google/j2objc/annotations/ReflectionSupport.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.j2objc.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface ReflectionSupport {
+ enum Level {
+ FULL
+ }
+
+ Level value();
+}
diff --git a/android-annotation-stubs/src/com/google/j2objc/annotations/RetainedWith.java b/android-annotation-stubs/src/com/google/j2objc/annotations/RetainedWith.java
new file mode 100644
index 000000000..30417f22d
--- /dev/null
+++ b/android-annotation-stubs/src/com/google/j2objc/annotations/RetainedWith.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.j2objc.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface RetainedWith {}
diff --git a/android-annotation-stubs/src/com/google/j2objc/annotations/Weak.java b/android-annotation-stubs/src/com/google/j2objc/annotations/Weak.java
new file mode 100644
index 000000000..a11d86adb
--- /dev/null
+++ b/android-annotation-stubs/src/com/google/j2objc/annotations/Weak.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.j2objc.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface Weak {}
diff --git a/android-annotation-stubs/src/com/google/j2objc/annotations/WeakOuter.java b/android-annotation-stubs/src/com/google/j2objc/annotations/WeakOuter.java
new file mode 100644
index 000000000..1e5748b44
--- /dev/null
+++ b/android-annotation-stubs/src/com/google/j2objc/annotations/WeakOuter.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.j2objc.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface WeakOuter {}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/MonotonicNonNullDecl.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/MonotonicNonNullDecl.java
new file mode 100644
index 000000000..9d7c9c37d
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/MonotonicNonNullDecl.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.checkerframework.checker.nullness.compatqual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface MonotonicNonNullDecl {}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NonNullDecl.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NonNullDecl.java
new file mode 100644
index 000000000..408277f70
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NonNullDecl.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.checkerframework.checker.nullness.compatqual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface NonNullDecl {}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NullableDecl.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NullableDecl.java
new file mode 100644
index 000000000..cfcaba565
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NullableDecl.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.checkerframework.checker.nullness.compatqual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface NullableDecl {}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java
new file mode 100644
index 000000000..f98da9131
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/MonotonicNonNull.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.checkerframework.checker.nullness.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface MonotonicNonNull {}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/NonNull.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/NonNull.java
new file mode 100644
index 000000000..876250fd7
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/NonNull.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.checkerframework.checker.nullness.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface NonNull {}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java
new file mode 100644
index 000000000..3c7975a46
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.checkerframework.checker.nullness.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface Nullable {}
diff --git a/android-annotation-stubs/src/org/codehaus/mojo/animal_sniffer/IgnoreJRERequirement.java b/android-annotation-stubs/src/org/codehaus/mojo/animal_sniffer/IgnoreJRERequirement.java
new file mode 100644
index 000000000..0eeee48f1
--- /dev/null
+++ b/android-annotation-stubs/src/org/codehaus/mojo/animal_sniffer/IgnoreJRERequirement.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.codehaus.mojo.animal_sniffer;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface IgnoreJRERequirement {}
diff --git a/android-annotation-stubs/tmpl.java b/android-annotation-stubs/tmpl.java
new file mode 100644
index 000000000..814c1432b
--- /dev/null
+++ b/android-annotation-stubs/tmpl.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package __PACKAGE__;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/* This is an annotation stub to avoid dependencies on annotations that aren't
+ * in the Android platform source tree. */
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface __CLASS__ {}