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
Merged-In: Iba30993c65ec038faba278df1bd5b438602191b4
Exempt-From-Owner-Approval: cherry pick
(cherry picked from commit dc6f1c2dc100ef77e4df17d6e11c49ab34672f15)
diff --git a/Android.bp b/Android.bp
index f5108e5..fbdc10f 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 @@
     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 0000000..82c06b1
--- /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 0000000..c1aae52
--- /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 0000000..985dd45
--- /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 0000000..30417f2
--- /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 0000000..a11d86a
--- /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 0000000..1e5748b
--- /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 0000000..9d7c9c3
--- /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 0000000..408277f
--- /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 0000000..cfcaba5
--- /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 0000000..f98da91
--- /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 0000000..876250f
--- /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 0000000..3c7975a
--- /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 0000000..0eeee48
--- /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 0000000..814c143
--- /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__ {}