diff options
author | Colin Cross <ccross@android.com> | 2020-06-26 00:26:41 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-26 00:26:41 +0000 |
commit | 405b0d4716a9fe69854f1a9231737185a159b045 (patch) | |
tree | ecd5609f67e4e53892485bab2b34c78a8f1f8842 | |
parent | 0c812a26fd54aa2022cc251a76a110105e542456 (diff) | |
parent | b4330c4fd8d6e2d0c996d61561bbda575f8ec362 (diff) | |
download | turbine-405b0d4716a9fe69854f1a9231737185a159b045.tar.gz |
Use AutoValue from external/auto am: b4330c4fd8
Original change: https://android-review.googlesource.com/c/platform/external/turbine/+/1344587
Change-Id: Id63527485e021411372f55ee1ab34ce4df0e01d1
5 files changed, 166 insertions, 2 deletions
@@ -20,6 +20,7 @@ java_library_host { srcs: [ "java/**/*.java", "proto/**/*.proto", + "android-annotation-stubs/src/**/*.java", ], manifest: "manifest.txt", @@ -28,8 +29,11 @@ java_library_host { "guava", ], - plugins: ["dagger2-auto-value"], - libs: ["dagger2-auto-value"], + plugins: ["auto_value_plugin"], + libs: [ + "auto_value_annotations", + "auto_value_memoized_extension_annotations", + ], proto: { type: "full", diff --git a/android-annotation-stubs/gen_annotations.sh b/android-annotation-stubs/gen_annotations.sh new file mode 100755 index 0000000..1965324 --- /dev/null +++ b/android-annotation-stubs/gen_annotations.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +declare -A INNER +declare -A PARAMETER +declare -A IMPORT + +ANNOTATIONS=( + org.checkerframework.checker.nullness.qual.Nullable + org.checkerframework.checker.nullness.compatqual.NullableDecl +) + +for a in ${ANNOTATIONS[@]}; do + package=${a%.*} + class=${a##*.} + dir=$(dirname $0)/src/${package//.//} + file=${class}.java + inner=${INNER[$a]} + parameter=${PARAMETER[$a]} + import= + + if [ -n "${parameter}" ]; then + parameter="${parameter} value();" + fi + + for i in ${IMPORT[$a]}; do + import="${import}import ${i};" + done + + mkdir -p ${dir} + sed -e"s/__PACKAGE__/${package}/" \ + -e"s/__CLASS__/${class}/" \ + -e"s/__INNER__/${inner}/" \ + -e"s/__PARAMETER__/${parameter}/" \ + -e"s/__IMPORT__/${import}/" \ + $(dirname $0)/tmpl.java > ${dir}/${file} + google-java-format -i ${dir}/${file} +done 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..2d39b0f --- /dev/null +++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/compatqual/NullableDecl.java @@ -0,0 +1,40 @@ +/* + * 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; + +/* 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 NullableDecl {} 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..276d64c --- /dev/null +++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java @@ -0,0 +1,40 @@ +/* + * 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; + +/* 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 Nullable {} diff --git a/android-annotation-stubs/tmpl.java b/android-annotation-stubs/tmpl.java new file mode 100644 index 0000000..c4df609 --- /dev/null +++ b/android-annotation-stubs/tmpl.java @@ -0,0 +1,43 @@ +/* + * 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; +__IMPORT__ + +/* 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__ { + __INNER__ + __PARAMETER__ +} |