Merge remote-tracking branch 'aosp/upstream-main'
* aosp/upstream-main: (86 commits)
Handle unicode characters that require two UTF-16 code units
Sort test inputs
Update to setup-java v2, and use adopt builds
Address compile errors that would appear when `ImmutableMap` is annotated for nullness in CL 382342656.
Remove obsolete parent per https://github.com/sonatype/oss-parents
Fix handling of repackaged transitive classes in jdeps
Inline a single-use abstract test class
Fix javadoc
Inherit from the sonatype oss parent artifact
Test invalid annotation element values are weeded out
Satisfy the nullness checker.
Use `assertThrows` for expected exception tests
Don't require an argument for `--compress_jar`
Satisfy the nullness checker
Fix NPEs in options parsing
Remove deprecated builders
Rename `master` branch to `main`
Never class-load `TurbineProcessingEnvironment` from the `-processor`
Update Error Prone and maven versions
Update turbine CI JDK versions
...
Bug: 193141629
Test: m checkbuild
Change-Id: If2e91cfa8c0b7d307acceb119b5ac4b195a4a237
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..f5880c2
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,58 @@
+//
+// Copyright (C) 2017 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 {
+ default_applicable_licenses: ["external_turbine_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "external_turbine_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text: [
+ "LICENSE",
+ ],
+}
+
+java_library_host {
+ name: "turbine",
+
+ srcs: [
+ "java/**/*.java",
+ "proto/**/*.proto",
+ "android-annotation-stubs/src/**/*.java",
+ ],
+
+ manifest: "manifest.txt",
+ static_libs: [
+ "error_prone_annotations",
+ "guava",
+ ],
+
+ plugins: ["auto_value_plugin"],
+ libs: [
+ "auto_value_annotations",
+ "auto_value_memoized_extension_annotations",
+ ],
+
+ proto: {
+ type: "full",
+ },
+}
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..e166a49
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,17 @@
+name: "turbine"
+description:
+ "Turbine is a header compiler for Java."
+
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://github.com/google/turbine"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/google/turbine"
+ }
+ version: "a963d859dc98108c37a701c1f76c4494fc480198"
+ last_upgrade_date { year: 2020 month: 3 day: 27 }
+ license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..70b375f
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+ccross@google.com
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__
+}
diff --git a/manifest.txt b/manifest.txt
new file mode 100644
index 0000000..00861d5
--- /dev/null
+++ b/manifest.txt
@@ -0,0 +1 @@
+Main-Class: com.google.turbine.main.Main