Merge "Implement vendor snapshot"
diff --git a/Changes.md b/Changes.md
index 70e338c..2720a0f 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,14 @@
# Build System Changes for Android.mk Writers
+## COPY_HEADERS usage now produces warnings {#copy_headers}
+
+We've considered `BUILD_COPY_HEADERS`/`LOCAL_COPY_HEADERS` to be deprecated for
+a long time, and the places where it's been able to be used have shrinked over
+the last several releases. Equivalent functionality is not available in Soong.
+
+See the [build/soong/docs/best_practices.md#headers] for more information about
+how best to handle headers in Android.
+
## `m4` is not available on `$PATH`
There is a prebuilt of it available in prebuilts/build-tools, and a make
@@ -553,6 +562,7 @@
[build/soong/Changes.md]: https://android.googlesource.com/platform/build/soong/+/master/Changes.md
+[build/soong/docs/best_practices.md#headers]: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers
[external/fonttools/Lib/fontTools/Android.bp]: https://android.googlesource.com/platform/external/fonttools/+/master/Lib/fontTools/Android.bp
[frameworks/base/Android.bp]: https://android.googlesource.com/platform/frameworks/base/+/master/Android.bp
[frameworks/base/data/fonts/Android.mk]: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/Android.mk
diff --git a/Deprecation.md b/Deprecation.md
index 9378e1a..5e26492 100644
--- a/Deprecation.md
+++ b/Deprecation.md
@@ -16,8 +16,11 @@
| -------------------------------- | --------- |
| `BUILD_AUX_EXECUTABLE` | Error |
| `BUILD_AUX_STATIC_LIBRARY` | Error |
+| `BUILD_COPY_HEADERS` | Warning |
+| `BUILD_HOST_EXECUTABLE` | Warning |
| `BUILD_HOST_FUZZ_TEST` | Error |
| `BUILD_HOST_NATIVE_TEST` | Error |
+| `BUILD_HOST_SHARED_LIBRARY` | Warning |
| `BUILD_HOST_SHARED_TEST_LIBRARY` | Error |
| `BUILD_HOST_STATIC_LIBRARY` | Warning |
| `BUILD_HOST_STATIC_TEST_LIBRARY` | Error |
diff --git a/core/Makefile b/core/Makefile
index 897a5ae..c862e97 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -16,7 +16,28 @@
define check-product-copy-files
$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
$(if $(filter %.apk, $(2)),$(error \
- Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
+ Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))) \
+$(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \
+ $(if $(filter $(TARGET_COPY_OUT_SYSTEM)/etc/vintf/% \
+ $(TARGET_COPY_OUT_SYSTEM)/manifest.xml \
+ $(TARGET_COPY_OUT_SYSTEM)/compatibility_matrix.xml,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), use vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_PRODUCT)/etc/vintf/%,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use PRODUCT_MANIFEST_FILES / DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/%,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use vintf_compatibility_matrix / vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_VENDOR)/etc/vintf/% \
+ $(TARGET_COPY_OUT_VENDOR)/manifest.xml \
+ $(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use DEVICE_MANIFEST_FILE / DEVICE_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
+ $(if $(filter $(TARGET_COPY_OUT_ODM)/etc/vintf/% \
+ $(TARGET_COPY_OUT_ODM)/etc/manifest%,$(2)), \
+ $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+ use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
+)
endef
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=
@@ -1550,6 +1571,8 @@
$(if $(filter $(2),userdata),\
$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(PRODUCT_FS_CASEFOLD),$(hide) echo "needs_casefold=$(PRODUCT_FS_CASEFOLD)" >> $(1))
+ $(if $(PRODUCT_QUOTA_PROJID),$(hide) echo "needs_projid=$(PRODUCT_QUOTA_PROJID)" >> $(1))
$(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),cache),\
@@ -3807,6 +3830,7 @@
mkbootfs \
mkbootimg \
mke2fs \
+ mke2fs.conf \
mkf2fsuserimg.sh \
mksquashfs \
mksquashfsimage.sh \
@@ -3828,6 +3852,15 @@
verity_verifier \
zipalign \
+# Additional tools to unpack and repack the apex file.
+INTERNAL_OTATOOLS_MODULES += \
+ apexer \
+ deapexer \
+ debugfs_static \
+ merge_zips \
+ resize2fs \
+ soong_zip \
+
ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
INTERNAL_OTATOOLS_MODULES += \
futility \
@@ -3883,7 +3916,7 @@
mkdir -p $(dir $@)
$(call copy-files-with-structure,$(PRIVATE_OTATOOLS_PACKAGE_FILES),$(HOST_OUT)/,$(PRIVATE_ZIP_ROOT))
$(call copy-files-with-structure,$(PRIVATE_OTATOOLS_RELEASETOOLS),build/make/tools/,$(PRIVATE_ZIP_ROOT))
- cp $(SOONG_ZIP) $(ZIP2ZIP) $(PRIVATE_ZIP_ROOT)/bin/
+ cp $(SOONG_ZIP) $(ZIP2ZIP) $(MERGE_ZIPS) $(PRIVATE_ZIP_ROOT)/bin/
$(SOONG_ZIP) -o $@ -C $(PRIVATE_ZIP_ROOT) -D $(PRIVATE_ZIP_ROOT)
.PHONY: otatools-package
diff --git a/core/board_config.mk b/core/board_config.mk
index b9b4dc2..5d658dc 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -26,6 +26,7 @@
BOARD_KERNEL_CMDLINE \
BOARD_KERNEL_BASE \
BOARD_USES_GENERIC_AUDIO \
+ BOARD_USES_RECOVERY_AS_BOOT \
BOARD_VENDOR_USE_AKMD \
BOARD_WPA_SUPPLICANT_DRIVER \
BOARD_WLAN_DEVICE \
@@ -86,10 +87,11 @@
_build_broken_var_list := \
BUILD_BROKEN_DUP_RULES \
+ BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
BUILD_BROKEN_PREBUILT_ELF_FILES \
BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
BUILD_BROKEN_USES_NETWORK \
- BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
+ BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
_build_broken_var_list += \
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
@@ -620,11 +622,15 @@
###########################################
# Handle BUILD_BROKEN_USES_BUILD_*
-$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
+$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_WARNING_BUILD_MODULE_TYPES)),\
$(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
$(KATI_obsolete_var $(m),Please convert to Soong),\
$(KATI_deprecated_var $(m),Please convert to Soong)))
+$(if $(filter false,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
+ $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\
+ $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers))
+
$(foreach m,$(DEFAULT_ERROR_BUILD_MODULE_TYPES),\
$(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
$(KATI_deprecated_var $(m),Please convert to Soong),\
diff --git a/core/config.mk b/core/config.mk
index c5f54de..844d7d6 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -228,6 +228,36 @@
# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive.
SOONG_CONFIG_NAMESPACES :=
+# The add_soong_config_namespace function adds a namespace and initializes it
+# to be empty.
+# $1 is the namespace.
+# Ex: $(call add_soong_config_namespace,acme)
+
+define add_soong_config_namespace
+$(eval SOONG_CONFIG_NAMESPACES += $1) \
+$(eval SOONG_CONFIG_$1 :=)
+endef
+
+# The add_soong_config_var function adds a a list of soong config variables to
+# SOONG_CONFIG_*. The variables and their values are then available to a
+# soong_config_module_type in an Android.bp file.
+# $1 is the namespace. $2 is the list of variables.
+# Ex: $(call add_soong_config_var,acme,COOL_FEATURE_A COOL_FEATURE_B)
+define add_soong_config_var
+$(eval SOONG_CONFIG_$1 += $2) \
+$(foreach v,$2,$(eval SOONG_CONFIG_$1_$v := $($v)))
+endef
+
+# The add_soong_config_var_value function defines a make variable and also adds
+# the variable to SOONG_CONFIG_*.
+# $1 is the namespace. $2 is the variable name. $3 is the variable value.
+# Ex: $(call add_soong_config_var_value,acme,COOL_FEATURE,true)
+
+define add_soong_config_var_value
+$(eval $2 := $3) \
+$(call add_soong_config_var,$1,$2)
+endef
+
# Set the extensions used for various packages
COMMON_PACKAGE_SUFFIX := .zip
COMMON_JAVA_PACKAGE_SUFFIX := .jar
diff --git a/core/definitions.mk b/core/definitions.mk
index 3a23289..fd785b8 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2200,7 +2200,7 @@
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
-$(hide) $(DX_COMMAND) $(DEX_FLAGS) \
+$(hide) $(D8_WRAPPER) $(DX_COMMAND) $(DEX_FLAGS) \
--output $(dir $@) \
$(addprefix --lib ,$(PRIVATE_D8_LIBS)) \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
@@ -2679,7 +2679,7 @@
define transform-jar-to-dex-r8
@echo R8: $@
$(hide) rm -f $(PRIVATE_PROGUARD_DICTIONARY)
-$(hide) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \
+$(hide) $(R8_WRAPPER) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \
-injars '$<' \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
--no-data-resources \
diff --git a/core/deprecation.mk b/core/deprecation.mk
index 761a9b6..cc620a3 100644
--- a/core/deprecation.mk
+++ b/core/deprecation.mk
@@ -1,15 +1,12 @@
# These module types can still be used without warnings or errors.
AVAILABLE_BUILD_MODULE_TYPES :=$= \
- BUILD_COPY_HEADERS \
BUILD_EXECUTABLE \
BUILD_FUZZ_TEST \
BUILD_HEADER_LIBRARY \
BUILD_HOST_DALVIK_JAVA_LIBRARY \
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY \
- BUILD_HOST_EXECUTABLE \
BUILD_HOST_JAVA_LIBRARY \
BUILD_HOST_PREBUILT \
- BUILD_HOST_SHARED_LIBRARY \
BUILD_JAVA_LIBRARY \
BUILD_MULTI_PREBUILT \
BUILD_NATIVE_TEST \
@@ -27,6 +24,9 @@
# relevant BUILD_BROKEN_USES_BUILD_* variables, then these would move to
# DEFAULT_ERROR_BUILD_MODULE_TYPES.
DEFAULT_WARNING_BUILD_MODULE_TYPES :=$= \
+ BUILD_COPY_HEADERS \
+ BUILD_HOST_EXECUTABLE \
+ BUILD_HOST_SHARED_LIBRARY \
BUILD_HOST_STATIC_LIBRARY \
# These are BUILD_* variables that are errors to reference, but you can set
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index 5dd5505..ccf53f5 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -73,8 +73,7 @@
$(call add_json_bool, DisablePreopt, $(call invert_bool,$(and $(filter true,$(PRODUCT_USES_DEFAULT_ART_CONFIG)),$(filter true,$(WITH_DEXPREOPT)))))
$(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES))
$(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY)))
- $(call add_json_bool, GenerateApexImage, $(filter true,$(DEXPREOPT_GENERATE_APEX_IMAGE)))
- $(call add_json_bool, UseApexImage, $(filter true,$(DEXPREOPT_USE_APEX_IMAGE)))
+ $(call add_json_bool, UseArtImage, $(filter true,$(DEXPREOPT_USE_ART_IMAGE)))
$(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)))
$(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
$(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX))
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 0fb2dd2..a33b2b4 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -113,8 +113,8 @@
my_dexpreopt_images_deps :=
my_dexpreopt_image_locations :=
my_dexpreopt_infix := boot
-ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
- my_dexpreopt_infix := jitzygote-boot
+ifeq (true, $(DEXPREOPT_USE_ART_IMAGE))
+ my_dexpreopt_infix := art
endif
ifdef LOCAL_DEX_PREOPT
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 27ff2c9..48072b3 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -132,8 +132,8 @@
CLANG_BIN=$(LLVM_PREBUILTS_PATH) \
CROSS_COMPILE=$(PRIVATE_TOOLS_PREFIX) \
XZ=$(XZ) \
- $(SOONG_STRIP_PATH) -i $< -o $@ -d $@.d $(PRIVATE_STRIP_ARGS)
- $(call include-depfile,$(strip_output).d)
+ $(SOONG_STRIP_PATH) -i $< -o $@ -d $@.strip.d $(PRIVATE_STRIP_ARGS)
+ $(call include-depfile,$(strip_output).strip.d,$(strip_output))
else
# Don't strip the binary, just copy it. We can't skip this step
# because a copy of the binary must appear at LOCAL_BUILT_MODULE.
diff --git a/core/executable.mk b/core/executable.mk
index c8d9272..db8dcc6 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -6,6 +6,10 @@
# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
# LOCAL_MODULE_STEM_64
+ifdef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,BUILD_EXECUTABLE is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_EXECUTABLE instead.)
+endif
+
my_skip_this_target :=
ifneq ($(filter address,$(SANITIZE_TARGET)),)
ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index 81236d1..c22af97 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -37,4 +37,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index 469da29..3dbd144 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -37,4 +37,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/main.mk b/core/main.mk
index 99e4e43..ec1effd 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -444,10 +444,6 @@
subdir_makefiles_total := $(words init post finish)
endif
-droid_targets: no_vendor_variant_vndk_check
-.PHONY: no_vendor_variant_vndk_check
-no_vendor_variant_vndk_check:
-
$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] finishing build rules ...)
# -------------------------------------------------------------------
@@ -1341,7 +1337,7 @@
endif
# Build docs as part of checkbuild to catch more breakages.
-module_to_check += $(ALL_DOCS)
+modules_to_check += $(ALL_DOCS)
# for easier debugging
modules_to_check := $(sort $(modules_to_check))
diff --git a/core/product_config.mk b/core/product_config.mk
index 1890599..eba72e4 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -335,6 +335,12 @@
endif
endif
+ifdef PRODUCT_SHIPPING_API_LEVEL
+ ifneq (,$(call math_gt_or_eq,29,$(PRODUCT_SHIPPING_API_LEVEL)))
+ PRODUCT_PACKAGES += $(PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29)
+ endif
+endif
+
# If build command defines OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS,
# override PRODUCT_EXTRA_VNDK_VERSIONS with it.
ifdef OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS
@@ -345,7 +351,11 @@
,Use PRODUCT_EXTRA_VNDK_VERSIONS instead)
ifdef OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
- PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE := $(OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE)
+ ifeq (false,$(OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE))
+ PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE :=
+ else
+ PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE := $(OVERRIDE_PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE)
+ endif
else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
# No shipping level defined
else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),29),true)
diff --git a/core/rbe.mk b/core/rbe.mk
index 231859b..7886e1a 100644
--- a/core/rbe.mk
+++ b/core/rbe.mk
@@ -21,12 +21,50 @@
else
rbe_dir := $(HOME)/rbe
endif
- RBE_WRAPPER := $(rbe_dir)/rewrapper --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD
+
+ ifdef RBE_CXX_EXEC_STRATEGY
+ cxx_rbe_exec_strategy := $(RBE_CXX_EXEC_STRATEGY)
+ else
+ cxx_rbe_exec_strategy := "local"
+ endif
+
+ ifdef RBE_JAVAC_EXEC_STRATEGY
+ javac_exec_strategy := $(RBE_JAVAC_EXEC_STRATEGY)
+ else
+ javac_exec_strategy := "local"
+ endif
+
+ ifdef RBE_R8_EXEC_STRATEGY
+ r8_exec_strategy := $(RBE_R8_EXEC_STRATEGY)
+ else
+ r8_exec_strategy := "local"
+ endif
+
+ ifdef RBE_D8_EXEC_STRATEGY
+ d8_exec_strategy := $(RBE_D8_EXEC_STRATEGY)
+ else
+ d8_exec_strategy := "local"
+ endif
+
+ RBE_WRAPPER := $(rbe_dir)/rewrapper
+ RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy)
# Append rewrapper to existing *_WRAPPER variables so it's possible to
# use both ccache and rewrapper.
- CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER))
- CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER))
+ CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
+ CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
+
+ ifdef RBE_JAVAC
+ JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac,shallow=true --exec_strategy=$(javac_exec_strategy))
+ endif
+
+ ifdef RBE_R8
+ R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8,shallow=true --exec_strategy=$(r8_exec_strategy))
+ endif
+
+ ifdef RBE_D8
+ D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8,shallow=true --exec_strategy=$(d8_exec_strategy))
+ endif
rbe_dir :=
endif
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 2832c17..ca17151 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -1,4 +1,7 @@
$(call record-module-type,SHARED_LIBRARY)
+ifdef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,BUILD_SHARED_LIBRARY is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_SHARED_LIBRARY instead.)
+endif
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
@@ -53,4 +56,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index ebb22c5..0a5ba9d 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -139,6 +139,9 @@
my_2nd_arch_prefix :=
PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
+ifndef LOCAL_CERTIFICATE
+ $(call pretty-error,LOCAL_CERTIFICATE must be set for soong_app_prebuilt.mk)
+endif
ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
# The magic string "PRESIGNED" means this package is already checked
# signed with its release key.
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 8ea1e50..190a7ed 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -130,7 +130,7 @@
$(same_vndk_variants_stamp): $(my_core_shared_lib) $(LOCAL_PREBUILT_MODULE_FILE)
$(call verify-vndk-libs-identical,\
$(PRIVATE_CORE_VARIANT),\
- $(PRIVATE_VENDOR_VARIANT)\
+ $(PRIVATE_VENDOR_VARIANT),\
$(PRIVATE_TOOLS_PREFIX))
$(LOCAL_BUILT_MODULE): $(same_vndk_variants_stamp)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 7c58082..e247a91 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -112,7 +112,8 @@
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
$(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS))
-$(call add_json_bool, NativeCoverage, $(filter true,$(NATIVE_COVERAGE)))
+$(call add_json_bool, NativeLineCoverage, $(filter true,$(NATIVE_LINE_COVERAGE)))
+$(call add_json_bool, Native_coverage, $(filter true,$(NATIVE_COVERAGE)))
$(call add_json_bool, ClangCoverage, $(filter true,$(CLANG_COVERAGE)))
$(call add_json_list, CoveragePaths, $(COVERAGE_PATHS))
$(call add_json_list, CoverageExcludePaths, $(COVERAGE_EXCLUDE_PATHS))
@@ -156,6 +157,9 @@
$(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA)))
$(call add_json_bool, UseRBE, $(filter-out false,$(USE_RBE)))
+$(call add_json_bool, UseRBEJAVAC, $(filter-out false,$(RBE_JAVAC)))
+$(call add_json_bool, UseRBER8, $(filter-out false,$(RBE_R8)))
+$(call add_json_bool, UseRBED8, $(filter-out false,$(RBE_D8)))
$(call add_json_bool, Arc, $(filter true,$(TARGET_ARC)))
$(call add_json_list, NamespacesToExport, $(PRODUCT_SOONG_NAMESPACES))
@@ -203,6 +207,8 @@
$(call add_json_bool, InstallExtraFlattenedApexes, $(PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES))
+$(call add_json_bool, BoardUsesRecoveryAsBoot, $(BOARD_USES_RECOVERY_AS_BOOT))
+
$(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents))
diff --git a/core/static_library.mk b/core/static_library.mk
index 8002e5c..78908cf 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,4 +1,7 @@
$(call record-module-type,STATIC_LIBRARY)
+ifdef LOCAL_IS_HOST_MODULE
+ $(call pretty-error,BUILD_STATIC_LIBRARY is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_STATIC_LIBRARY instead)
+endif
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
@@ -38,4 +41,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
-include $(BUILD_COPY_HEADERS)
+ifdef LOCAL_COPY_HEADERS
+$(call pretty-warning,LOCAL_COPY_HEADERS is deprecated. See $(CHANGES_URL)#copy_headers)
+include $(BUILD_SYSTEM)/copy_headers.mk
+endif
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 5d445e0..57268ce 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -250,7 +250,7 @@
# It must be of the form "YYYY-MM-DD" on production devices.
# It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2020-01-01
+ PLATFORM_SECURITY_PATCH := 2020-02-05
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
diff --git a/envsetup.sh b/envsetup.sh
index 389fbb7..793f4b6 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -254,6 +254,9 @@
local ANDROID_LLVM_BINUTILS=$(get_abs_build_var ANDROID_CLANG_PREBUILTS)/llvm-binutils-stable
ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_LLVM_BINUTILS
+ # Set up ASAN_SYMBOLIZER_PATH for SANITIZE_HOST=address builds.
+ export ASAN_SYMBOLIZER_PATH=$ANDROID_LLVM_BINUTILS/llvm-symbolizer
+
# If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH
# to ensure that the corresponding 'emulator' binaries are used.
case $(uname -s) in
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index 52ba814..c57968e 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -46,6 +46,3 @@
# Include stats logging code in LMKD
TARGET_LMKD_STATS_LOG := true
-
-# Generate an APEX image for experiment b/119800099.
-DEXPREOPT_GENERATE_APEX_IMAGE := true
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
new file mode 100644
index 0000000..7c91607
--- /dev/null
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := arm64-v8a
+TARGET_CPU_ABI2 :=
+TARGET_CPU_VARIANT := generic
+
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv8-a
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+TARGET_2ND_CPU_VARIANT := generic
+
+# TODO(jiyong) These might be SoC specific.
+BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
+
+# TODO(b/36764215): remove this setting when the generic system image
+# no longer has QCOM-specific directories under /.
+BOARD_SEPOLICY_DIRS += build/make/target/board/generic_arm64/sepolicy
diff --git a/target/board/generic_arm_ab/BoardConfig.mk b/target/board/generic_arm_ab/BoardConfig.mk
new file mode 100644
index 0000000..21b763c
--- /dev/null
+++ b/target/board/generic_arm_ab/BoardConfig.mk
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv7-a-neon
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+TARGET_CPU_VARIANT := generic
+
+# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
+TARGET_USES_64_BIT_BINDER := false
+
+# TODO(jiyong) These might be SoC specific.
+BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
+
+# TODO(b/36764215): remove this setting when the generic system image
+# no longer has QCOM-specific directories under /.
+BOARD_SEPOLICY_DIRS += build/make/target/board/generic_arm64/sepolicy
diff --git a/target/board/generic_x86_64_ab/BoardConfig.mk b/target/board/generic_x86_64_ab/BoardConfig.mk
new file mode 100644
index 0000000..1dd5e48
--- /dev/null
+++ b/target/board/generic_x86_64_ab/BoardConfig.mk
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+
+TARGET_2ND_CPU_ABI := x86
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86_64
diff --git a/target/board/generic_x86_ab/BoardConfig.mk b/target/board/generic_x86_ab/BoardConfig.mk
new file mode 100644
index 0000000..53acffd
--- /dev/null
+++ b/target/board/generic_x86_ab/BoardConfig.mk
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+include build/make/target/board/BoardConfigGsiCommon.mk
+
+TARGET_CPU_ABI := x86
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86
+
+# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
+TARGET_USES_64_BIT_BINDER := false
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 5ecaf26..4121bc1 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -43,9 +43,13 @@
else
PRODUCT_MAKEFILES := \
+ $(LOCAL_DIR)/aosp_arm64_ab.mk \
$(LOCAL_DIR)/aosp_arm64.mk \
+ $(LOCAL_DIR)/aosp_arm_ab.mk \
$(LOCAL_DIR)/aosp_arm.mk \
+ $(LOCAL_DIR)/aosp_x86_64_ab.mk \
$(LOCAL_DIR)/aosp_x86_64.mk \
+ $(LOCAL_DIR)/aosp_x86_ab.mk \
$(LOCAL_DIR)/aosp_x86_arm.mk \
$(LOCAL_DIR)/aosp_x86.mk \
$(LOCAL_DIR)/full.mk \
diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk
new file mode 100644
index 0000000..75b9cc4
--- /dev/null
+++ b/target/product/aosp_arm64_ab.mk
@@ -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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_arm64_ab-userdebug is a Legacy GSI for the devices with:
+# - ARM 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_arm64_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_arm64_ab
+PRODUCT_DEVICE := generic_arm64_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM64
diff --git a/target/product/aosp_arm_ab.mk b/target/product/aosp_arm_ab.mk
new file mode 100644
index 0000000..80ebdb1
--- /dev/null
+++ b/target/product/aosp_arm_ab.mk
@@ -0,0 +1,57 @@
+#
+# 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_arm_ab-userdebug is a Legacy GSI for the devices with:
+# - ARM 32 bits user space
+# - 32 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_arm_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_arm_ab
+PRODUCT_DEVICE := generic_arm_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM32
diff --git a/target/product/aosp_product.mk b/target/product/aosp_product.mk
index aefad82..9b9ccb1 100644
--- a/target/product/aosp_product.mk
+++ b/target/product/aosp_product.mk
@@ -31,7 +31,6 @@
PRODUCT_PACKAGES += \
messaging \
PhotoTable \
- WAPPushManager \
WallpaperPicker \
# Telephony:
diff --git a/target/product/aosp_x86_64_ab.mk b/target/product/aosp_x86_64_ab.mk
new file mode 100644
index 0000000..9d23fc7
--- /dev/null
+++ b/target/product/aosp_x86_64_ab.mk
@@ -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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_x86_64_ab-userdebug is a Legacy GSI for the devices with:
+# - x86 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_x86_64_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_x86_64_ab
+PRODUCT_DEVICE := generic_x86_64_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on x86_64
diff --git a/target/product/aosp_x86_ab.mk b/target/product/aosp_x86_ab.mk
new file mode 100644
index 0000000..6b6a4c6
--- /dev/null
+++ b/target/product/aosp_x86_ab.mk
@@ -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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# gsi_system.prop.
+
+# aosp_x86_ab-userdebug is a Legacy GSI for the devices with:
+# - x86 32 bits user space
+# - 32 bits binder interface
+# - system-as-root
+
+#
+# All components inherited here go to system image
+# (The system image of Legacy GSI is not CSI)
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
+
+# Enable mainline checking for excat this product name
+ifeq (aosp_x86_ab,$(TARGET_PRODUCT))
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+endif
+
+#
+# All components inherited here go to system_ext image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_release.mk)
+
+PRODUCT_NAME := aosp_x86_ab
+PRODUCT_DEVICE := generic_x86_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on x86
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 8ced9ab..20fd189 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -132,6 +132,7 @@
libdrmframework_jni \
libEGL \
libETC1 \
+ libfdtrack \
libFFTEm \
libfilterfw \
libgatekeeper \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index 9ed2ef1..469e231 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -41,7 +41,6 @@
# Base modules and settings for the vendor partition.
PRODUCT_PACKAGES += \
android.hardware.cas@1.1-service \
- android.hardware.configstore@1.1-service \
android.hardware.media.omx@1.0-service \
boringssl_self_test_vendor \
dumpsys_vendor \
@@ -70,6 +69,10 @@
vndservice \
vndservicemanager \
+# Base module when shipping api level is less than or equal to 29
+PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29 += \
+ android.hardware.configstore@1.1-service \
+
# VINTF data for vendor image
PRODUCT_PACKAGES += \
vendor_compatibility_matrix.xml \
diff --git a/target/product/emulated_storage.mk b/target/product/emulated_storage.mk
new file mode 100644
index 0000000..89de192
--- /dev/null
+++ b/target/product/emulated_storage.mk
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2020 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.
+#
+
+PRODUCT_QUOTA_PROJID := 1
+PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.projid=1
+
+PRODUCT_FS_CASEFOLD := 1
+PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.casefold=1
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 4f2027f..bd8450b 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -163,6 +163,7 @@
vndkcorevariant.libraries.txt \
$(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \
$(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \
+ $(VNDK_USING_CORE_VARIANT_LIBRARIES) \
com.android.vndk.current
endif
include $(BUILD_PHONY_PACKAGE)
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index f2415f4..dd4a64f 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -110,6 +110,7 @@
VNDK-core: android.hardware.drm@1.1.so
VNDK-core: android.hardware.drm@1.2.so
VNDK-core: android.hardware.dumpstate@1.0.so
+VNDK-core: android.hardware.dumpstate@1.1.so
VNDK-core: android.hardware.fastboot@1.0.so
VNDK-core: android.hardware.gatekeeper@1.0.so
VNDK-core: android.hardware.gnss.measurement_corrections@1.0.so
@@ -135,6 +136,7 @@
VNDK-core: android.hardware.keymaster@3.0.so
VNDK-core: android.hardware.keymaster@4.0.so
VNDK-core: android.hardware.keymaster@4.1.so
+VNDK-core: android.hardware.light-V1-ndk_platform.so
VNDK-core: android.hardware.light@2.0.so
VNDK-core: android.hardware.media.bufferpool@1.0.so
VNDK-core: android.hardware.media.bufferpool@2.0.so
@@ -236,8 +238,6 @@
VNDK-core: libhardware_legacy.so
VNDK-core: libhidlallocatorutils.so
VNDK-core: libjpeg.so
-VNDK-core: libkeymaster_messages.so
-VNDK-core: libkeymaster_portable.so
VNDK-core: libldacBT_abr.so
VNDK-core: libldacBT_enc.so
VNDK-core: liblz4.so
@@ -253,11 +253,8 @@
VNDK-core: libpng.so
VNDK-core: libpower.so
VNDK-core: libprocinfo.so
-VNDK-core: libprotobuf-cpp-lite-3.9.1.so
-VNDK-core: libpuresoftkeymasterdevice.so
VNDK-core: libradio_metadata.so
VNDK-core: libselinux.so
-VNDK-core: libsoftkeymasterdevice.so
VNDK-core: libspeexresampler.so
VNDK-core: libsqlite.so
VNDK-core: libssl.so
diff --git a/target/product/legacy_gsi_release.mk b/target/product/legacy_gsi_release.mk
new file mode 100644
index 0000000..f072481
--- /dev/null
+++ b/target/product/legacy_gsi_release.mk
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2020 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.
+#
+
+include $(SRC_TARGET_DIR)/product/gsi_release.mk
+
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+ system/etc/init/init.legacy-gsi.rc \
+ system/etc/init/gsi/init.vndk-27.rc \
+ system/etc/ld.config.vndk_lite.txt \
+
+# Legacy GSI support additional O-MR1 interface
+PRODUCT_EXTRA_VNDK_VERSIONS += 27
+
+# Support for the O-MR1 devices
+PRODUCT_COPY_FILES += \
+ build/make/target/product/gsi/init.legacy-gsi.rc:system/etc/init/init.legacy-gsi.rc \
+ build/make/target/product/gsi/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc
+
+# Namespace configuration file for non-enforcing VNDK
+PRODUCT_PACKAGES += \
+ ld.config.vndk_lite.txt
+
+# Legacy GSI relax the compatible property checking
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := false
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index c880971..ccbc907 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -24,9 +24,6 @@
# Enable updating of APEXes
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
-# Mainline devices support userspace reboot
-$(call inherit-product, $(SRC_TARGET_DIR)/product/userspace_reboot.mk)
-
# Shared java libs
PRODUCT_PACKAGES += \
com.android.nfc_extras \
diff --git a/target/product/virtual_ab_ota.mk b/target/product/virtual_ab_ota.mk
index c00b0ed..1774de4 100644
--- a/target/product/virtual_ab_ota.mk
+++ b/target/product/virtual_ab_ota.mk
@@ -16,4 +16,6 @@
PRODUCT_VIRTUAL_AB_OTA := true
-PRODUCT_PRODUCT_PROPERTIES += ro.virtual_ab.enabled=true
+PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.enabled=true
+
+PRODUCT_PACKAGES += e2fsck_ramdisk
diff --git a/target/product/virtual_ab_ota_retrofit.mk b/target/product/virtual_ab_ota_retrofit.mk
index b492fad..3e85741 100644
--- a/target/product/virtual_ab_ota_retrofit.mk
+++ b/target/product/virtual_ab_ota_retrofit.mk
@@ -18,4 +18,4 @@
PRODUCT_VIRTUAL_AB_OTA_RETROFIT := true
-PRODUCT_PRODUCT_PROPERTIES += ro.virtual_ab.retrofit=true
+PRODUCT_PROPERTY_OVERRIDES += ro.virtual_ab.retrofit=true
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index ee3c463..4fac6f3 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -18,6 +18,7 @@
import os.path
import re
import shlex
+import shutil
import zipfile
import common
@@ -41,6 +42,140 @@
Exception.__init__(self, message)
+class ApexApkSigner(object):
+ """Class to sign the apk files in a apex payload image and repack the apex"""
+
+ def __init__(self, apex_path, key_passwords, codename_to_api_level_map):
+ self.apex_path = apex_path
+ self.key_passwords = key_passwords
+ self.codename_to_api_level_map = codename_to_api_level_map
+
+ def ProcessApexFile(self, apk_keys, payload_key, payload_public_key,
+ signing_args=None):
+ """Scans and signs the apk files and repack the apex
+
+ Args:
+ apk_keys: A dict that holds the signing keys for apk files.
+ payload_key: The path to the apex payload signing key.
+ payload_public_key: The path to the public key corresponding to the
+ payload signing key.
+
+ Returns:
+ The repacked apex file containing the signed apk files.
+ """
+ list_cmd = ['deapexer', 'list', self.apex_path]
+ entries_names = common.RunAndCheckOutput(list_cmd).split()
+ apk_entries = [name for name in entries_names if name.endswith('.apk')]
+
+ # No need to sign and repack, return the original apex path.
+ if not apk_entries:
+ logger.info('No apk file to sign in %s', self.apex_path)
+ return self.apex_path
+
+ for entry in apk_entries:
+ apk_name = os.path.basename(entry)
+ if apk_name not in apk_keys:
+ raise ApexSigningError('Failed to find signing keys for apk file {} in'
+ ' apex {}. Use "-e <apkname>=" to specify a key'
+ .format(entry, self.apex_path))
+ if not any(dirname in entry for dirname in ['app/', 'priv-app/',
+ 'overlay/']):
+ logger.warning('Apk path does not contain the intended directory name:'
+ ' %s', entry)
+
+ payload_dir, has_signed_apk = self.ExtractApexPayloadAndSignApks(
+ apk_entries, apk_keys)
+ if not has_signed_apk:
+ logger.info('No apk file has been signed in %s', self.apex_path)
+ return self.apex_path
+
+ return self.RepackApexPayload(payload_dir, payload_key, payload_public_key,
+ signing_args)
+
+ def ExtractApexPayloadAndSignApks(self, apk_entries, apk_keys):
+ """Extracts the payload image and signs the containing apk files."""
+ payload_dir = common.MakeTempDir()
+ extract_cmd = ['deapexer', 'extract', self.apex_path, payload_dir]
+ common.RunAndCheckOutput(extract_cmd)
+
+ has_signed_apk = False
+ for entry in apk_entries:
+ apk_path = os.path.join(payload_dir, entry)
+ assert os.path.exists(self.apex_path)
+
+ key_name = apk_keys.get(os.path.basename(entry))
+ if key_name in common.SPECIAL_CERT_STRINGS:
+ logger.info('Not signing: %s due to special cert string', apk_path)
+ continue
+
+ logger.info('Signing apk file %s in apex %s', apk_path, self.apex_path)
+ # Rename the unsigned apk and overwrite the original apk path with the
+ # signed apk file.
+ unsigned_apk = common.MakeTempFile()
+ os.rename(apk_path, unsigned_apk)
+ common.SignFile(unsigned_apk, apk_path, key_name, self.key_passwords,
+ codename_to_api_level_map=self.codename_to_api_level_map)
+ has_signed_apk = True
+ return payload_dir, has_signed_apk
+
+ def RepackApexPayload(self, payload_dir, payload_key, payload_public_key,
+ signing_args=None):
+ """Rebuilds the apex file with the updated payload directory."""
+ apex_dir = common.MakeTempDir()
+ # Extract the apex file and reuse its meta files as repack parameters.
+ common.UnzipToDir(self.apex_path, apex_dir)
+
+ android_jar_path = common.OPTIONS.android_jar_path
+ if not android_jar_path:
+ android_jar_path = os.path.join(os.environ.get('ANDROID_BUILD_TOP', ''),
+ 'prebuilts', 'sdk', 'current', 'public',
+ 'android.jar')
+ logger.warning('android_jar_path not found in options, falling back to'
+ ' use %s', android_jar_path)
+
+ arguments_dict = {
+ 'manifest': os.path.join(apex_dir, 'apex_manifest.pb'),
+ 'build_info': os.path.join(apex_dir, 'apex_build_info.pb'),
+ 'android_jar_path': android_jar_path,
+ 'key': payload_key,
+ 'pubkey': payload_public_key,
+ }
+ for filename in arguments_dict.values():
+ assert os.path.exists(filename), 'file {} not found'.format(filename)
+
+ # The repack process will add back these files later in the payload image.
+ for name in ['apex_manifest.pb', 'apex_manifest.json', 'lost+found']:
+ path = os.path.join(payload_dir, name)
+ if os.path.isfile(path):
+ os.remove(path)
+ elif os.path.isdir(path):
+ shutil.rmtree(path)
+
+ repacked_apex = common.MakeTempFile(suffix='.apex')
+ repack_cmd = ['apexer', '--force', '--include_build_info',
+ '--do_not_check_keyname', '--apexer_tool_path',
+ os.getenv('PATH')]
+ for key, val in arguments_dict.items():
+ repack_cmd.extend(['--' + key, val])
+ # Add quote to the signing_args as we will pass
+ # --signing_args "--signing_helper_with_files=%path" to apexer
+ if signing_args:
+ repack_cmd.extend(['--signing_args', '"{}"'.format(signing_args)])
+ # optional arguments for apex repacking
+ manifest_json = os.path.join(apex_dir, 'apex_manifest.json')
+ if os.path.exists(manifest_json):
+ repack_cmd.extend(['--manifest_json', manifest_json])
+ assets_dir = os.path.join(apex_dir, 'assets')
+ if os.path.isdir(assets_dir):
+ repack_cmd.extend(['--assets_dir', assets_dir])
+ repack_cmd.extend([payload_dir, repacked_apex])
+ if OPTIONS.verbose:
+ repack_cmd.append('-v')
+ common.RunAndCheckOutput(repack_cmd)
+
+ return repacked_apex
+
+
def SignApexPayload(avbtool, payload_file, payload_key_path, payload_key_name,
algorithm, salt, no_hashtree, signing_args=None):
"""Signs a given payload_file with the payload key."""
@@ -155,7 +290,8 @@
def SignApex(avbtool, apex_data, payload_key, container_key, container_pw,
- codename_to_api_level_map, no_hashtree, signing_args=None):
+ apk_keys, codename_to_api_level_map,
+ no_hashtree, signing_args=None):
"""Signs the current APEX with the given payload/container keys.
Args:
@@ -163,6 +299,7 @@
payload_key: The path to payload signing key (w/ extension).
container_key: The path to container signing key (w/o extension).
container_pw: The matching password of the container_key, or None.
+ apk_keys: A dict that holds the signing keys for apk files.
codename_to_api_level_map: A dict that maps from codename to API level.
no_hashtree: Don't include hashtree in the signed APEX.
signing_args: Additional args to be passed to the payload signer.
@@ -177,7 +314,15 @@
APEX_PAYLOAD_IMAGE = 'apex_payload.img'
APEX_PUBKEY = 'apex_pubkey'
- # 1a. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given
+ # 1. Extract the apex payload image and sign the containing apk files. Repack
+ # the apex file after signing.
+ payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
+ apk_signer = ApexApkSigner(apex_file, container_pw,
+ codename_to_api_level_map)
+ apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key,
+ payload_public_key, signing_args)
+
+ # 2a. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given
# payload_key.
payload_dir = common.MakeTempDir(prefix='apex-payload-')
with zipfile.ZipFile(apex_file) as apex_fd:
@@ -195,8 +340,7 @@
no_hashtree,
signing_args)
- # 1b. Update the embedded payload public key.
- payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
+ # 2b. Update the embedded payload public key.
common.ZipDelete(apex_file, APEX_PAYLOAD_IMAGE)
if APEX_PUBKEY in zip_items:
@@ -206,11 +350,11 @@
common.ZipWrite(apex_zip, payload_public_key, arcname=APEX_PUBKEY)
common.ZipClose(apex_zip)
- # 2. Align the files at page boundary (same as in apexer).
+ # 3. Align the files at page boundary (same as in apexer).
aligned_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex')
common.RunAndCheckOutput(['zipalign', '-f', '4096', apex_file, aligned_apex])
- # 3. Sign the APEX container with container_key.
+ # 4. Sign the APEX container with container_key.
signed_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex')
# Specify the 4K alignment when calling SignApk.
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 1e7d387..e424b6f 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -248,6 +248,8 @@
build_command = []
fs_type = prop_dict.get("fs_type", "")
run_e2fsck = False
+ needs_projid = prop_dict.get("needs_projid", 0)
+ needs_casefold = prop_dict.get("needs_casefold", 0)
if fs_type.startswith("ext"):
build_command = [prop_dict["ext_mkuserimg"]]
@@ -287,7 +289,10 @@
build_command.extend(["-S", prop_dict["hash_seed"]])
if "ext4_share_dup_blocks" in prop_dict:
build_command.append("-c")
- build_command.extend(["--inode_size", "256"])
+ if (needs_projid):
+ build_command.extend(["--inode_size", "512"])
+ else:
+ build_command.extend(["--inode_size", "256"])
if "selinux_fc" in prop_dict:
build_command.append(prop_dict["selinux_fc"])
elif fs_type.startswith("squash"):
@@ -328,6 +333,10 @@
if "timestamp" in prop_dict:
build_command.extend(["-T", str(prop_dict["timestamp"])])
build_command.extend(["-L", prop_dict["mount_point"]])
+ if (needs_projid):
+ build_command.append("--prjquota")
+ if (needs_casefold):
+ build_command.append("--casefold")
else:
raise BuildImageError(
"Error: unknown filesystem type: {}".format(fs_type))
@@ -598,6 +607,8 @@
copy_prop("flash_logical_block_size", "flash_logical_block_size")
copy_prop("flash_erase_block_size", "flash_erase_block_size")
copy_prop("userdata_selinux_fc", "selinux_fc")
+ copy_prop("needs_casefold", "needs_casefold")
+ copy_prop("needs_projid", "needs_projid")
elif mount_point == "cache":
copy_prop("cache_fs_type", "fs_type")
copy_prop("cache_size", "partition_size")
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 6a6f119..2e235ee 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -69,6 +69,7 @@
self.extra_signapk_args = []
self.java_path = "java" # Use the one on the path by default.
self.java_args = ["-Xmx2048m"] # The default JVM args.
+ self.android_jar_path = None
self.public_key_suffix = ".x509.pem"
self.private_key_suffix = ".pk8"
# use otatools built boot_signer by default
@@ -1823,7 +1824,7 @@
argv, "hvp:s:x:" + extra_opts,
["help", "verbose", "path=", "signapk_path=",
"signapk_shared_library_path=", "extra_signapk_args=",
- "java_path=", "java_args=", "public_key_suffix=",
+ "java_path=", "java_args=", "android_jar_path=", "public_key_suffix=",
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
"verity_signer_path=", "verity_signer_args=", "device_specific=",
"extra=", "logfile=", "aftl_server=", "aftl_key_path=",
@@ -1852,6 +1853,8 @@
OPTIONS.java_path = a
elif o in ("--java_args",):
OPTIONS.java_args = shlex.split(a)
+ elif o in ("--android_jar_path",):
+ OPTIONS.android_jar_path = a
elif o in ("--public_key_suffix",):
OPTIONS.public_key_suffix = a
elif o in ("--private_key_suffix",):
diff --git a/tools/releasetools/sign_apex.py b/tools/releasetools/sign_apex.py
index 4c0850c..b0128dc 100755
--- a/tools/releasetools/sign_apex.py
+++ b/tools/releasetools/sign_apex.py
@@ -31,6 +31,10 @@
--payload_extra_args <args>
Optional flag that specifies any extra args to be passed to payload signer
(e.g. --payload_extra_args="--signing_helper_with_files /path/to/helper").
+
+ -e (--extra_apks) <name,name,...=key>
+ Add extra APK name/key pairs. This is useful to sign the apk files in the
+ apex payload image.
"""
import logging
@@ -43,8 +47,8 @@
logger = logging.getLogger(__name__)
-def SignApexFile(avbtool, apex_file, payload_key, container_key,
- no_hashtree, signing_args=None):
+def SignApexFile(avbtool, apex_file, payload_key, container_key, no_hashtree,
+ apk_keys=None, signing_args=None):
"""Signs the given apex file."""
with open(apex_file, 'rb') as input_fp:
apex_data = input_fp.read()
@@ -57,6 +61,7 @@
container_pw=None,
codename_to_api_level_map=None,
no_hashtree=no_hashtree,
+ apk_keys=apk_keys,
signing_args=signing_args)
@@ -77,18 +82,26 @@
options['payload_key'] = a
elif o == '--payload_extra_args':
options['payload_extra_args'] = a
+ elif o in ("-e", "--extra_apks"):
+ names, key = a.split("=")
+ names = names.split(",")
+ for n in names:
+ if 'extra_apks' not in options:
+ options['extra_apks'] = {}
+ options['extra_apks'].update({n: key})
else:
return False
return True
args = common.ParseOptions(
argv, __doc__,
- extra_opts='',
+ extra_opts='e:',
extra_long_opts=[
'avbtool=',
'container_key=',
'payload_extra_args=',
'payload_key=',
+ 'extra_apks=',
],
extra_option_handler=option_handler)
@@ -105,6 +118,7 @@
options['payload_key'],
options['container_key'],
no_hashtree=False,
+ apk_keys=options.get('extra_apks', {}),
signing_args=options.get('payload_extra_args'))
shutil.copyfile(signed_apex, args[1])
logger.info("done.")
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index fffbace..cce771c 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -103,6 +103,9 @@
Specify any additional args that are needed to AVB-sign the image
(e.g. "--signing_helper /path/to/helper"). The args will be appended to
the existing ones in info dict.
+
+ --android_jar_path <path>
+ Path to the android.jar to repack the apex file.
"""
from __future__ import print_function
@@ -151,6 +154,7 @@
OPTIONS.avb_keys = {}
OPTIONS.avb_algorithms = {}
OPTIONS.avb_extra_args = {}
+OPTIONS.android_jar_path = None
AVB_FOOTER_ARGS_BY_PARTITION = {
@@ -492,6 +496,7 @@
payload_key,
container_key,
key_passwords[container_key],
+ apk_keys,
codename_to_api_level_map,
no_hashtree=True,
signing_args=OPTIONS.avb_extra_args.get('apex'))
@@ -1247,6 +1252,8 @@
apex_keys_info = ReadApexKeysInfo(input_zip)
apex_keys = GetApexKeys(apex_keys_info, apk_keys)
+ # TODO(xunchang) check for the apks inside the apex files, and abort early if
+ # the keys are not available.
CheckApkAndApexKeysAvailable(
input_zip,
set(apk_keys.keys()) | set(apex_keys.keys()),
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index 5d4cc77..07284ad 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -16,6 +16,7 @@
import os
import os.path
+import zipfile
import apex_utils
import common
@@ -32,6 +33,8 @@
# The default payload signing key.
self.payload_key = os.path.join(self.testdata_dir, 'testkey.key')
+ common.OPTIONS.search_path = test_utils.get_search_path()
+
@staticmethod
def _GetTestPayload():
payload_file = common.MakeTempFile(prefix='apex-', suffix='.img')
@@ -126,3 +129,67 @@
payload_file,
os.path.join(self.testdata_dir, 'testkey_with_passwd.key'),
no_hashtree=True)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_noApkPresent(self):
+ apex_path = os.path.join(self.testdata_dir, 'foo.apex')
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ processed_apex = signer.ProcessApexFile({}, self.payload_key,
+ None)
+ self.assertEqual(apex_path, processed_apex)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_apkKeyNotPresent(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ self.assertRaises(apex_utils.ApexSigningError, signer.ProcessApexFile, {},
+ self.payload_key, None)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_signApk(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+
+ self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ payload_pubkey = common.ExtractAvbPublicKey('avbtool',
+ self.payload_key)
+ signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_noAssetDir(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ no_asset = common.MakeTempFile(suffix='.apex')
+ with zipfile.ZipFile(no_asset, 'w') as output_zip:
+ with zipfile.ZipFile(apex_path, 'r') as input_zip:
+ name_list = input_zip.namelist()
+ for name in name_list:
+ if not name.startswith('assets'):
+ output_zip.writestr(name, input_zip.read(name))
+
+ signer = apex_utils.ApexApkSigner(no_asset, None, None)
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+
+ self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ payload_pubkey = common.ExtractAvbPublicKey('avbtool',
+ self.payload_key)
+ signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_ApexApkSigner_withSignerHelper(self):
+ apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ signer = apex_utils.ApexApkSigner(apex_path, None, None)
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+
+ self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ payload_pubkey = common.ExtractAvbPublicKey('avbtool', self.payload_key)
+
+ signing_helper = os.path.join(self.testdata_dir, 'signing_helper.sh')
+ os.chmod(signing_helper, 0o700)
+ payload_signer_args = '--signing_helper_with_files={}'.format(
+ signing_helper)
+ signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey,
+ payload_signer_args)
diff --git a/tools/releasetools/test_sign_apex.py b/tools/releasetools/test_sign_apex.py
index 79d1de4..82f5938 100644
--- a/tools/releasetools/test_sign_apex.py
+++ b/tools/releasetools/test_sign_apex.py
@@ -41,3 +41,19 @@
container_key,
False)
self.assertTrue(os.path.exists(signed_foo_apex))
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_SignApexWithApk(self):
+ test_apex = os.path.join(self.testdata_dir, 'has_apk.apex')
+ payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ container_key = os.path.join(self.testdata_dir, 'testkey')
+ apk_keys = {'wifi-service-resources.apk': os.path.join(
+ self.testdata_dir, 'testkey')}
+ signed_test_apex = sign_apex.SignApexFile(
+ 'avbtool',
+ test_apex,
+ payload_key,
+ container_key,
+ False,
+ apk_keys)
+ self.assertTrue(os.path.exists(signed_test_apex))
diff --git a/tools/releasetools/testdata/has_apk.apex b/tools/releasetools/testdata/has_apk.apex
new file mode 100644
index 0000000..12bbdf9
--- /dev/null
+++ b/tools/releasetools/testdata/has_apk.apex
Binary files differ
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 9c2bc51..1b918cc 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -350,7 +350,7 @@
# vbmeta partitions (e.g. vbmeta_system).
image = os.path.join(input_tmp, 'IMAGES', 'vbmeta.img')
cmd = [info_dict['avb_avbtool'], 'verify_image', '--image', image,
- '--key', key, '--follow_chain_partitions']
+ '--follow_chain_partitions']
# Append the args for chained partitions if any.
for partition in common.AVB_PARTITIONS + common.AVB_VBMETA_PARTITIONS:
diff --git a/tools/warn/cpp_warn_patterns.py b/tools/warn/cpp_warn_patterns.py
index 0c458fb..65ce73a 100644
--- a/tools/warn/cpp_warn_patterns.py
+++ b/tools/warn/cpp_warn_patterns.py
@@ -435,6 +435,30 @@
[r".*: warning: template argument.+Wunnamed-type-template-args"]),
medium('Unannotated fall-through between switch labels',
[r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]),
+ medium('Invalid partial specialization',
+ [r".*: warning: class template partial specialization.+Winvalid-partial-specialization"]),
+ medium('Overlapping compatisons',
+ [r".*: warning: overlapping comparisons.+Wtautological-overlap-compare"]),
+ medium('int in bool context',
+ [r".*: warning: converting.+to a boolean.+Wint-in-bool-context"]),
+ medium('bitwise conditional parentheses',
+ [r".*: warning: operator.+has lower precedence.+Wbitwise-conditional-parentheses"]),
+ medium('sizeof array div',
+ [r".*: warning: .+number of elements in.+array.+Wsizeof-array-div"]),
+ medium('bool operation',
+ [r".*: warning: .+boolean.+always.+Wbool-operation"]),
+ medium('Undefined bool conversion',
+ [r".*: warning: .+may be.+always.+true.+Wundefined-bool-conversion"]),
+ medium('Typedef requires a name',
+ [r".*: warning: typedef requires a name.+Wmissing-declaration"]),
+ medium('Unknown escape sequence',
+ [r".*: warning: unknown escape sequence.+Wunknown-escape-sequence"]),
+ medium('Unicode whitespace',
+ [r".*: warning: treating Unicode.+as whitespace.+Wunicode-whitespace"]),
+ medium('Unused local typedef',
+ [r".*: warning: unused typedef.+Wunused-local-typedef"]),
+ medium('varargs warnings',
+ [r".*: warning: .*argument to 'va_start'.+\[-Wvarargs\]"]),
harmless('Discarded qualifier from pointer target type',
[r".*: warning: .+ discards '.+' qualifier from pointer target type"]),
harmless('Use snprintf instead of sprintf',
diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
index 0a443d4..80e2e1d 100644
--- a/tools/warn/java_warn_patterns.py
+++ b/tools/warn/java_warn_patterns.py
@@ -38,8 +38,24 @@
return java_warn(Severity.MEDIUM, description, pattern_list)
-def java_low(description, pattern_list):
- return java_warn(Severity.LOW, description, pattern_list)
+def warn_with_name(name, severity, description=None):
+ if description is None:
+ description = name
+ return java_warn(severity, description,
+ [r'.*\.java:.*: warning: .+ \[' + name + r'\]$',
+ r'.*\.java:.*: warning: \[' + name + r'\] .+'])
+
+
+def high(name, description=None):
+ return warn_with_name(name, Severity.HIGH, description)
+
+
+def medium(name, description=None):
+ return warn_with_name(name, Severity.MEDIUM, description)
+
+
+def low(name, description=None):
+ return warn_with_name(name, Severity.LOW, description)
warn_patterns = [
@@ -48,8 +64,13 @@
java_medium('Use of deprecated',
[r'.*: warning: \[deprecation\] .+',
r'.*: warning: \[removal\] .+ has been deprecated and marked for removal$']),
- java_medium('Unchecked conversion',
- [r'.*: warning: \[unchecked\] .+']),
+ java_medium('Incompatible SDK implementation',
+ [r'.*\.java:.*: warning: @Implementation .+ has .+ not .+ as in the SDK ']),
+ medium('unchecked', 'Unchecked conversion'),
+ java_medium('No annotation method',
+ [r'.*\.class\): warning: Cannot find annotation method .+ in']),
+ java_medium('No class/method in SDK ...',
+ [r'.*\.java:.*: warning: No such (class|method) .* for SDK']),
# Warnings generated by Error Prone
java_medium('Non-ascii characters used, but ascii encoding specified',
[r".*: warning: unmappable character for encoding ascii"]),
@@ -65,682 +86,700 @@
[r".*: warning: .* stripped of .* superclass .* \[HiddenSuperclass\]"]),
java_high('Use of internal proprietary API',
[r".*: warning: .* is internal proprietary API and may be removed"]),
- java_low('Use parameter comments to document ambiguous literals',
- [r".*: warning: \[BooleanParameter\] .+"]),
- java_low('This class\'s name looks like a Type Parameter.',
- [r".*: warning: \[ClassNamedLikeTypeParameter\] .+"]),
- java_low('Field name is CONSTANT_CASE, but field is not static and final',
- [r".*: warning: \[ConstantField\] .+"]),
- java_low('@Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
- [r".*: warning: \[EmptySetMultibindingContributions\] .+"]),
- java_low('Prefer assertThrows to ExpectedException',
- [r".*: warning: \[ExpectedExceptionRefactoring\] .+"]),
- java_low('This field is only assigned during initialization; consider making it final',
- [r".*: warning: \[FieldCanBeFinal\] .+"]),
- java_low('Fields that can be null should be annotated @Nullable',
- [r".*: warning: \[FieldMissingNullable\] .+"]),
- java_low('Refactors uses of the JSR 305 @Immutable to Error Prone\'s annotation',
- [r".*: warning: \[ImmutableRefactoring\] .+"]),
- java_low(u'Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
- [r".*: warning: \[LambdaFunctionalInterface\] .+"]),
- java_low('A private method that does not reference the enclosing instance can be static',
- [r".*: warning: \[MethodCanBeStatic\] .+"]),
- java_low('C-style array declarations should not be used',
- [r".*: warning: \[MixedArrayDimensions\] .+"]),
- java_low('Variable declarations should declare only one variable',
- [r".*: warning: \[MultiVariableDeclaration\] .+"]),
- java_low('Source files should not contain multiple top-level class declarations',
- [r".*: warning: \[MultipleTopLevelClasses\] .+"]),
- java_low('Avoid having multiple unary operators acting on the same variable in a method call',
- [r".*: warning: \[MultipleUnaryOperatorsInMethodCall\] .+"]),
- java_low('OnNameExpected naming style',
- [r".*\.java:.*: warning: .+ \[OnNameExpected\]$"]),
- java_low('Package names should match the directory they are declared in',
- [r".*: warning: \[PackageLocation\] .+"]),
- java_low('Non-standard parameter comment; prefer `/* paramName= */ arg`',
- [r".*: warning: \[ParameterComment\] .+"]),
- java_low('Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
- [r".*: warning: \[ParameterNotNullable\] .+"]),
- java_low('Add a private constructor to modules that will not be instantiated by Dagger.',
- [r".*: warning: \[PrivateConstructorForNoninstantiableModule\] .+"]),
- java_low('Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
- [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]),
- java_low('Unused imports',
- [r".*: warning: \[RemoveUnusedImports\] .+"]),
- java_low('Methods that can return null should be annotated @Nullable',
- [r".*: warning: \[ReturnMissingNullable\] .+"]),
- java_low('Scopes on modules have no function and will soon be an error.',
- [r".*: warning: \[ScopeOnModule\] .+"]),
- java_low('The default case of a switch should appear at the end of the last statement group',
- [r".*: warning: \[SwitchDefault\] .+"]),
- java_low('Prefer assertThrows to @Test(expected=...)',
- [r".*: warning: \[TestExceptionRefactoring\] .+"]),
- java_low('Unchecked exceptions do not need to be declared in the method signature.',
- [r".*: warning: \[ThrowsUncheckedException\] .+"]),
- java_low('Prefer assertThrows to try/fail',
- [r".*: warning: \[TryFailRefactoring\] .+"]),
- java_low('Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter \'T\'.',
- [r".*: warning: \[TypeParameterNaming\] .+"]),
- java_low('Constructors and methods with the same name should appear sequentially with no other code in between. Please re-order or re-name methods.',
- [r".*: warning: \[UngroupedOverloads\] .+"]),
- java_low('Unnecessary call to NullPointerTester#setDefault',
- [r".*: warning: \[UnnecessarySetDefault\] .+"]),
- java_low('Using static imports for types is unnecessary',
- [r".*: warning: \[UnnecessaryStaticImport\] .+"]),
- java_low('@Binds is a more efficient and declarative mechanism for delegating a binding.',
- [r".*: warning: \[UseBinds\] .+"]),
- java_low('Wildcard imports, static or otherwise, should not be used',
- [r".*: warning: \[WildcardImport\] .+"]),
- java_medium('AcronymName',
- [r".*\.java:.*: warning: .+ \[AcronymName\]$"]),
- java_medium('Method reference is ambiguous',
- [r".*: warning: \[AmbiguousMethodReference\] .+"]),
- java_medium('This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
- [r".*: warning: \[AnnotateFormatMethod\] .+"]),
- java_medium('Annotations should be positioned after Javadocs, but before modifiers..',
- [r".*: warning: \[AnnotationPosition\] .+"]),
- java_medium('Arguments are in the wrong order or could be commented for clarity.',
- [r".*: warning: \[ArgumentSelectionDefectChecker\] .+"]),
- java_medium('Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs.',
- [r".*: warning: \[ArrayAsKeyOfSetOrMap\] .+"]),
- java_medium('Arguments are swapped in assertEquals-like call',
- [r".*: warning: \[AssertEqualsArgumentOrderChecker\] .+"]),
- java_medium('Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
- [r".*: warning: \[AssertFalse\] .+"]),
- java_medium('The lambda passed to assertThrows should contain exactly one statement',
- [r".*: warning: \[AssertThrowsMultipleStatements\] .+"]),
- java_medium('This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.',
- [r".*: warning: \[AssertionFailureIgnored\] .+"]),
- java_medium('@AssistedInject and @Inject should not be used on different constructors in the same class.',
- [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]),
- java_medium('Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them',
- [r".*: warning: \[AutoValueFinalMethods\] .+"]),
- java_medium('Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
- [r".*: warning: \[BadAnnotationImplementation\] .+"]),
- java_medium('Possible sign flip from narrowing conversion',
- [r".*: warning: \[BadComparable\] .+"]),
- java_medium('Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer.',
- [r".*: warning: \[BadImport\] .+"]),
- java_medium('instanceof used in a way that is equivalent to a null check.',
- [r".*: warning: \[BadInstanceof\] .+"]),
- java_medium('BigDecimal#equals has surprising behavior: it also compares scale.',
- [r".*: warning: \[BigDecimalEquals\] .+"]),
- java_medium('new BigDecimal(double) loses precision in this case.',
- [r".*: warning: \[BigDecimalLiteralDouble\] .+"]),
- java_medium('A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
- [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]),
- java_medium('This code declares a binding for a common value type without a Qualifier annotation.',
- [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]),
- java_medium('valueOf or autoboxing provides better time and space performance',
- [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]),
- java_medium('ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().',
- [r".*: warning: \[ByteBufferBackingArray\] .+"]),
- java_medium('Mockito cannot mock final classes',
- [r".*: warning: \[CannotMockFinalClass\] .+"]),
- java_medium('Duration can be expressed more clearly with different units',
- [r".*: warning: \[CanonicalDuration\] .+"]),
- java_medium('Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace',
- [r".*: warning: \[CatchAndPrintStackTrace\] .+"]),
- java_medium('Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful',
- [r".*: warning: \[CatchFail\] .+"]),
- java_medium('Inner class is non-static but does not reference enclosing class',
- [r".*: warning: \[ClassCanBeStatic\] .+"]),
- java_medium('Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance()',
- [r".*: warning: \[ClassNewInstance\] .+"]),
- java_medium('Providing Closeable resources makes their lifecycle unclear',
- [r".*: warning: \[CloseableProvides\] .+"]),
- java_medium('The type of the array parameter of Collection.toArray needs to be compatible with the array type',
- [r".*: warning: \[CollectionToArraySafeParameter\] .+"]),
- java_medium('Collector.of() should not use state',
- [r".*: warning: \[CollectorShouldNotUseState\] .+"]),
- java_medium('Class should not implement both `Comparable` and `Comparator`',
- [r".*: warning: \[ComparableAndComparator\] .+"]),
- java_medium('Constructors should not invoke overridable methods.',
- [r".*: warning: \[ConstructorInvokesOverridable\] .+"]),
- java_medium('Constructors should not pass the \'this\' reference out in method invocations, since the object may not be fully constructed.',
- [r".*: warning: \[ConstructorLeaksThis\] .+"]),
- java_medium('DateFormat is not thread-safe, and should not be used as a constant field.',
- [r".*: warning: \[DateFormatConstant\] .+"]),
- java_medium('Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
- [r".*: warning: \[DefaultCharset\] .+"]),
- java_medium('Avoid deprecated Thread methods; read the method\'s javadoc for details.',
- [r".*: warning: \[DeprecatedThreadMethods\] .+"]),
- java_medium('Prefer collection factory methods or builders to the double-brace initialization pattern.',
- [r".*: warning: \[DoubleBraceInitialization\] .+"]),
- java_medium('Double-checked locking on non-volatile fields is unsafe',
- [r".*: warning: \[DoubleCheckedLocking\] .+"]),
- java_medium('Empty top-level type declaration',
- [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]),
- java_medium('equals() implementation may throw NullPointerException when given null',
- [r".*: warning: \[EqualsBrokenForNull\] .+"]),
- java_medium('Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.',
- [r".*: warning: \[EqualsGetClass\] .+"]),
- java_medium('Classes that override equals should also override hashCode.',
- [r".*: warning: \[EqualsHashCode\] .+"]),
- java_medium('An equality test between objects with incompatible types always returns false',
- [r".*: warning: \[EqualsIncompatibleType\] .+"]),
- java_medium('The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.',
- [r".*: warning: \[EqualsUnsafeCast\] .+"]),
- java_medium('Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.',
- [r".*: warning: \[EqualsUsingHashCode\] .+"]),
- java_medium('Calls to ExpectedException#expect should always be followed by exactly one statement.',
- [r".*: warning: \[ExpectedExceptionChecker\] .+"]),
- java_medium('When only using JUnit Assert\'s static methods, you should import statically instead of extending.',
- [r".*: warning: \[ExtendingJUnitAssert\] .+"]),
- java_medium('Switch case may fall through',
- [r".*: warning: \[FallThrough\] .+"]),
- java_medium('If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.',
- [r".*: warning: \[Finally\] .+"]),
- java_medium('Use parentheses to make the precedence explicit',
- [r".*: warning: \[FloatCast\] .+"]),
- java_medium('This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality.',
- [r".*: warning: \[FloatingPointAssertionWithinEpsilon\] .+"]),
- java_medium('Floating point literal loses precision',
- [r".*: warning: \[FloatingPointLiteralPrecision\] .+"]),
- java_medium('Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
- [r".*: warning: \[FragmentInjection\] .+"]),
- java_medium('Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
- [r".*: warning: \[FragmentNotInstantiable\] .+"]),
- java_medium('Overloads will be ambiguous when passing lambda arguments',
- [r".*: warning: \[FunctionalInterfaceClash\] .+"]),
- java_medium('Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.',
- [r".*: warning: \[FutureReturnValueIgnored\] .+"]),
- java_medium('Calling getClass() on an enum may return a subclass of the enum type',
- [r".*: warning: \[GetClassOnEnum\] .+"]),
- java_medium('Hardcoded reference to /sdcard',
- [r".*: warning: \[HardCodedSdCardPath\] .+"]),
- java_medium('Hiding fields of superclasses may cause confusion and errors',
- [r".*: warning: \[HidingField\] .+"]),
- java_medium('Annotations should always be immutable',
- [r".*: warning: \[ImmutableAnnotationChecker\] .+"]),
- java_medium('Enums should always be immutable',
- [r".*: warning: \[ImmutableEnumChecker\] .+"]),
- java_medium('This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
- [r".*: warning: \[IncompatibleModifiers\] .+"]),
- java_medium('It is confusing to have a field and a parameter under the same scope that differ only in capitalization.',
- [r".*: warning: \[InconsistentCapitalization\] .+"]),
- java_medium('Including fields in hashCode which are not compared in equals violates the contract of hashCode.',
- [r".*: warning: \[InconsistentHashCode\] .+"]),
- java_medium('The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
- [r".*: warning: \[InconsistentOverloads\] .+"]),
- java_medium('This for loop increments the same variable in the header and in the body',
- [r".*: warning: \[IncrementInForLoopAndHeader\] .+"]),
- java_medium('Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
- [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]),
- java_medium('Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
- [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]),
- java_medium('Casting inside an if block should be plausibly consistent with the instanceof type',
- [r".*: warning: \[InstanceOfAndCastMatchWrongType\] .+"]),
- java_medium('Expression of type int may overflow before being assigned to a long',
- [r".*: warning: \[IntLongMath\] .+"]),
- java_medium('IntentBuilderName',
- [r".*\.java:.*: warning: .+ \[IntentBuilderName\]$"]),
- java_medium('This @param tag doesn\'t refer to a parameter of the method.',
- [r".*: warning: \[InvalidParam\] .+"]),
- java_medium('This tag is invalid.',
- [r".*: warning: \[InvalidTag\] .+"]),
- java_medium('The documented method doesn\'t actually throw this checked exception.',
- [r".*: warning: \[InvalidThrows\] .+"]),
- java_medium('Class should not implement both `Iterable` and `Iterator`',
- [r".*: warning: \[IterableAndIterator\] .+"]),
- java_medium('Floating-point comparison without error tolerance',
- [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]),
- java_medium('Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.',
- [r".*: warning: \[JUnit4ClassUsedInJUnit3\] .+"]),
- java_medium('Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.',
- [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]),
- java_medium('Never reuse class names from java.lang',
- [r".*: warning: \[JavaLangClash\] .+"]),
- java_medium('Suggests alternatives to obsolete JDK classes.',
- [r".*: warning: \[JdkObsolete\] .+"]),
- java_medium('Calls to Lock#lock should be immediately followed by a try block which releases the lock.',
- [r".*: warning: \[LockNotBeforeTry\] .+"]),
- java_medium('Assignment where a boolean expression was expected; use == if this assignment wasn\'t expected or add parentheses for clarity.',
- [r".*: warning: \[LogicalAssignment\] .+"]),
- java_medium('Math.abs does not always give a positive result. Please consider other methods for positive random numbers.',
- [r".*: warning: \[MathAbsoluteRandom\] .+"]),
- java_medium('Switches on enum types should either handle all values, or have a default case.',
- [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]),
- java_medium('The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)',
- [r".*: warning: \[MissingDefault\] .+"]),
- java_medium('Not calling fail() when expecting an exception masks bugs',
- [r".*: warning: \[MissingFail\] .+"]),
- java_medium('method overrides method in supertype; expected @Override',
- [r".*: warning: \[MissingOverride\] .+"]),
- java_medium('A collection or proto builder was created, but its values were never accessed.',
- [r".*: warning: \[ModifiedButNotUsed\] .+"]),
- java_medium('Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown.',
- [r".*: warning: \[ModifyCollectionInEnhancedForLoop\] .+"]),
- java_medium('Multiple calls to either parallel or sequential are unnecessary and cause confusion.',
- [r".*: warning: \[MultipleParallelOrSequentialCalls\] .+"]),
- java_medium('Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
- [r".*: warning: \[MutableConstantField\] .+"]),
- java_medium('Method return type should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
- [r".*: warning: \[MutableMethodReturnType\] .+"]),
- java_medium('Compound assignments may hide dangerous casts',
- [r".*: warning: \[NarrowingCompoundAssignment\] .+"]),
- java_medium('Nested instanceOf conditions of disjoint types create blocks of code that never execute',
- [r".*: warning: \[NestedInstanceOfConditions\] .+"]),
- java_medium('Instead of returning a functional type, return the actual type that the returned function would return and use lambdas at use site.',
- [r".*: warning: \[NoFunctionalReturnType\] .+"]),
- java_medium('This update of a volatile variable is non-atomic',
- [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]),
- java_medium('Static import of member uses non-canonical name',
- [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]),
- java_medium('equals method doesn\'t override Object.equals',
- [r".*: warning: \[NonOverridingEquals\] .+"]),
- java_medium('Not closeable',
- [r".*\.java:.*: warning: .+ \[NotCloseable\]$"]),
- java_medium('Constructors should not be annotated with @Nullable since they cannot return null',
- [r".*: warning: \[NullableConstructor\] .+"]),
- java_medium('Dereference of possibly-null value',
- [r".*: warning: \[NullableDereference\] .+"]),
- java_medium('@Nullable should not be used for primitive types since they cannot be null',
- [r".*: warning: \[NullablePrimitive\] .+"]),
- java_medium('void-returning methods should not be annotated with @Nullable, since they cannot return null',
- [r".*: warning: \[NullableVoid\] .+"]),
- java_medium('Calling toString on Objects that don\'t override toString() doesn\'t provide useful information',
- [r".*: warning: \[ObjectToString\] .+"]),
- java_medium('Objects.hashCode(Object o) should not be passed a primitive value',
- [r".*: warning: \[ObjectsHashCodePrimitive\] .+"]),
- java_medium('Use grouping parenthesis to make the operator precedence explicit',
- [r".*: warning: \[OperatorPrecedence\] .+"]),
- java_medium('One should not call optional.get() inside an if statement that checks !optional.isPresent',
- [r".*: warning: \[OptionalNotPresent\] .+"]),
- java_medium('String literal contains format specifiers, but is not passed to a format method',
- [r".*: warning: \[OrphanedFormatString\] .+"]),
- java_medium('To return a custom message with a Throwable class, one should override getMessage() instead of toString() for Throwable.',
- [r".*: warning: \[OverrideThrowableToString\] .+"]),
- java_medium('Varargs doesn\'t agree for overridden method',
- [r".*: warning: \[Overrides\] .+"]),
- java_medium('This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
- [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]),
- java_medium('Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter',
- [r".*: warning: \[ParameterName\] .+"]),
- java_medium('Preconditions only accepts the %s placeholder in error message strings',
- [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]),
- java_medium('Passing a primitive array to a varargs method is usually wrong',
- [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]),
- java_medium('A field on a protocol buffer was set twice in the same chained expression.',
- [r".*: warning: \[ProtoRedundantSet\] .+"]),
- java_medium('Protos should not be used as a key to a map, in a set, or in a contains method on a descendant of a collection. Protos have non deterministic ordering and proto equality is deep, which is a performance issue.',
- [r".*: warning: \[ProtosAsKeyOfSetOrMap\] .+"]),
- java_medium('BugChecker has incorrect ProvidesFix tag, please update',
- [r".*: warning: \[ProvidesFix\] .+"]),
- java_medium('Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.',
- [r".*: warning: \[QualifierOrScopeOnInjectMethod\] .+"]),
- java_medium('Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.',
- [r".*: warning: \[QualifierWithTypeUse\] .+"]),
- java_medium('reachabilityFence should always be called inside a finally block',
- [r".*: warning: \[ReachabilityFenceUsage\] .+"]),
- java_medium('Thrown exception is a subtype of another',
- [r".*: warning: \[RedundantThrows\] .+"]),
- java_medium('Comparison using reference equality instead of value equality',
- [r".*: warning: \[ReferenceEquality\] .+"]),
- java_medium('This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
- [r".*: warning: \[RequiredModifiers\] .+"]),
- java_medium('Void methods should not have a @return tag.',
- [r".*: warning: \[ReturnFromVoid\] .+"]),
- java_medium('SAM-compatible parameters should be last',
- [r".*\.java:.*: warning: .+ \[SamShouldBeLast\]$"]),
- java_medium(u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
- [r".*: warning: \[ShortCircuitBoolean\] .+"]),
- java_medium('Writes to static fields should not be guarded by instance locks',
- [r".*: warning: \[StaticGuardedByInstance\] .+"]),
- java_medium('A static variable or method should be qualified with a class name, not expression',
- [r".*: warning: \[StaticQualifiedUsingExpression\] .+"]),
- java_medium('Streams that encapsulate a closeable resource should be closed using try-with-resources',
- [r".*: warning: \[StreamResourceLeak\] .+"]),
- java_medium('String comparison using reference equality instead of value equality',
- [r".*: warning: \[StringEquality\] .+"]),
- java_medium('String.split(String) has surprising behavior',
- [r".*: warning: \[StringSplitter\] .+"]),
- java_medium('SWIG generated code that can\'t call a C++ destructor will leak memory',
- [r".*: warning: \[SwigMemoryLeak\] .+"]),
- java_medium('Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
- [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]),
- java_medium('Code that contains System.exit() is untestable.',
- [r".*: warning: \[SystemExitOutsideMain\] .+"]),
- java_medium('Using @Test(expected=...) is discouraged, since the test will pass if *any* statement in the test method throws the expected exception',
- [r".*: warning: \[TestExceptionChecker\] .+"]),
- java_medium('Thread.join needs to be surrounded by a loop until it succeeds, as in Uninterruptibles.joinUninterruptibly.',
- [r".*: warning: \[ThreadJoinLoop\] .+"]),
- java_medium('ThreadLocals should be stored in static fields',
- [r".*: warning: \[ThreadLocalUsage\] .+"]),
- java_medium('Relying on the thread scheduler is discouraged; see Effective Java Item 72 (2nd edition) / 84 (3rd edition).',
- [r".*: warning: \[ThreadPriorityCheck\] .+"]),
- java_medium('Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead.',
- [r".*: warning: \[ThreeLetterTimeZoneID\] .+"]),
- java_medium('An implementation of Object.toString() should never return null.',
- [r".*: warning: \[ToStringReturnsNull\] .+"]),
- java_medium('The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.',
- [r".*: warning: \[TruthAssertExpected\] .+"]),
- java_medium('Truth Library assert is called on a constant.',
- [r".*: warning: \[TruthConstantAsserts\] .+"]),
- java_medium('Argument is not compatible with the subject\'s type.',
- [r".*: warning: \[TruthIncompatibleType\] .+"]),
- java_medium('Type parameter declaration shadows another named type',
- [r".*: warning: \[TypeNameShadowing\] .+"]),
- java_medium('Type parameter declaration overrides another type parameter already declared',
- [r".*: warning: \[TypeParameterShadowing\] .+"]),
- java_medium('Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
- [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]),
- java_medium('Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.',
- [r".*: warning: \[URLEqualsHashCode\] .+"]),
- java_medium('Collection, Iterable, Multimap, and Queue do not have well-defined equals behavior',
- [r".*: warning: \[UndefinedEquals\] .+"]),
- java_medium('Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.',
- [r".*: warning: \[UnnecessaryDefaultInEnumSwitch\] .+"]),
- java_medium('Unnecessary use of grouping parentheses',
- [r".*: warning: \[UnnecessaryParentheses\] .+"]),
- java_medium('Finalizer may run before native code finishes execution',
- [r".*: warning: \[UnsafeFinalization\] .+"]),
- java_medium('Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor.',
- [r".*: warning: \[UnsafeReflectiveConstructionCast\] .+"]),
- java_medium('Unsynchronized method overrides a synchronized method.',
- [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]),
- java_medium('Unused.',
- [r".*: warning: \[Unused\] .+"]),
- java_medium('This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder.',
- [r".*: warning: \[UnusedException\] .+"]),
- java_medium('Java assert is used in test. For testing purposes Assert.* matchers should be used.',
- [r".*: warning: \[UseCorrectAssertInTests\] .+"]),
- java_medium('UserHandle',
- [r".*\.java:.*: warning: .+ \[UserHandle\]$"]),
- java_medium('UserHandleName',
- [r".*\.java:.*: warning: .+ \[UserHandleName\]$"]),
- java_medium('Non-constant variable missing @Var annotation',
- [r".*: warning: \[Var\] .+"]),
- java_medium('variableName and type with the same name would refer to the static field instead of the class',
- [r".*: warning: \[VariableNameSameAsType\] .+"]),
- java_medium('Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
- [r".*: warning: \[WaitNotInLoop\] .+"]),
- java_medium('A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
- [r".*: warning: \[WakelockReleasedDangerously\] .+"]),
- java_high('AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
- [r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]),
- java_high('Use of class, field, or method that is not compatible with legacy Android devices',
- [r".*: warning: \[AndroidJdkLibsChecker\] .+"]),
- java_high('Reference equality used to compare arrays',
- [r".*: warning: \[ArrayEquals\] .+"]),
- java_high('Arrays.fill(Object[], Object) called with incompatible types.',
- [r".*: warning: \[ArrayFillIncompatibleType\] .+"]),
- java_high('hashcode method on array does not hash array contents',
- [r".*: warning: \[ArrayHashCode\] .+"]),
- java_high('ArrayReturn',
- [r".*\.java:.*: warning: .+ \[ArrayReturn\]$"]),
- java_high('Calling toString on an array does not provide useful information',
- [r".*: warning: \[ArrayToString\] .+"]),
- java_high('Arrays.asList does not autobox primitive arrays, as one might expect.',
- [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]),
- java_high('@AssistedInject and @Inject cannot be used on the same constructor.',
- [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]),
- java_high('AsyncCallable should not return a null Future, only a Future whose result is null.',
- [r".*: warning: \[AsyncCallableReturnsNull\] .+"]),
- java_high('AsyncFunction should not return a null Future, only a Future whose result is null.',
- [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]),
- java_high('@AutoFactory and @Inject should not be used in the same type.',
- [r".*: warning: \[AutoFactoryAtInject\] .+"]),
- java_high('Arguments to AutoValue constructor are in the wrong order',
- [r".*: warning: \[AutoValueConstructorOrderChecker\] .+"]),
- java_high('Shift by an amount that is out of range',
- [r".*: warning: \[BadShiftAmount\] .+"]),
- java_high('Object serialized in Bundle may have been flattened to base type.',
- [r".*: warning: \[BundleDeserializationCast\] .+"]),
- java_high('The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.',
- [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]),
- java_high('Ignored return value of method that is annotated with @CheckReturnValue',
- [r".*: warning: \[CheckReturnValue\] .+"]),
- java_high('The source file name should match the name of the top-level class it contains',
- [r".*: warning: \[ClassName\] .+"]),
- java_high('Incompatible type as argument to Object-accepting Java collections method',
- [r".*: warning: \[CollectionIncompatibleType\] .+"]),
- java_high(u'Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
- [r".*: warning: \[ComparableType\] .+"]),
- java_high('this == null is always false, this != null is always true',
- [r".*: warning: \[ComparingThisWithNull\] .+"]),
- java_high('This comparison method violates the contract',
- [r".*: warning: \[ComparisonContractViolated\] .+"]),
- java_high('Comparison to value that is out of range for the compared type',
- [r".*: warning: \[ComparisonOutOfRange\] .+"]),
- java_high('@CompatibleWith\'s value is not a type argument.',
- [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]),
- java_high('Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
- [r".*: warning: \[CompileTimeConstant\] .+"]),
- java_high('Non-trivial compile time constant boolean expressions shouldn\'t be used.',
- [r".*: warning: \[ComplexBooleanConstant\] .+"]),
- java_high('A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression\'s result may not be of the expected type.',
- [r".*: warning: \[ConditionalExpressionNumericPromotion\] .+"]),
- java_high('Compile-time constant expression overflows',
- [r".*: warning: \[ConstantOverflow\] .+"]),
- java_high('Dagger @Provides methods may not return null unless annotated with @Nullable',
- [r".*: warning: \[DaggerProvidesNull\] .+"]),
- java_high('Exception created but not thrown',
- [r".*: warning: \[DeadException\] .+"]),
- java_high('Thread created but not started',
- [r".*: warning: \[DeadThread\] .+"]),
+ low('BooleanParameter',
+ 'Use parameter comments to document ambiguous literals'),
+ low('ClassNamedLikeTypeParameter',
+ 'This class\'s name looks like a Type Parameter.'),
+ low('ConstantField',
+ 'Field name is CONSTANT_CASE, but field is not static and final'),
+ low('EmptySetMultibindingContributions',
+ '@Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.'),
+ low('ExpectedExceptionRefactoring',
+ 'Prefer assertThrows to ExpectedException'),
+ low('FieldCanBeFinal',
+ 'This field is only assigned during initialization; consider making it final'),
+ low('FieldMissingNullable',
+ 'Fields that can be null should be annotated @Nullable'),
+ low('ImmutableRefactoring',
+ 'Refactors uses of the JSR 305 @Immutable to Error Prone\'s annotation'),
+ low('LambdaFunctionalInterface',
+ u'Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.'),
+ low('MethodCanBeStatic',
+ 'A private method that does not reference the enclosing instance can be static'),
+ low('MixedArrayDimensions',
+ 'C-style array declarations should not be used'),
+ low('MultiVariableDeclaration',
+ 'Variable declarations should declare only one variable'),
+ low('MultipleTopLevelClasses',
+ 'Source files should not contain multiple top-level class declarations'),
+ low('MultipleUnaryOperatorsInMethodCall',
+ 'Avoid having multiple unary operators acting on the same variable in a method call'),
+ low('OnNameExpected',
+ 'OnNameExpected naming style'),
+ low('PackageLocation',
+ 'Package names should match the directory they are declared in'),
+ low('ParameterComment',
+ 'Non-standard parameter comment; prefer `/* paramName= */ arg`'),
+ low('ParameterNotNullable',
+ 'Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable'),
+ low('PrivateConstructorForNoninstantiableModule',
+ 'Add a private constructor to modules that will not be instantiated by Dagger.'),
+ low('PrivateConstructorForUtilityClass',
+ 'Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.'),
+ low('RemoveUnusedImports',
+ 'Unused imports'),
+ low('ReturnMissingNullable',
+ 'Methods that can return null should be annotated @Nullable'),
+ low('ScopeOnModule',
+ 'Scopes on modules have no function and will soon be an error.'),
+ low('SwitchDefault',
+ 'The default case of a switch should appear at the end of the last statement group'),
+ low('TestExceptionRefactoring',
+ 'Prefer assertThrows to @Test(expected=...)'),
+ low('ThrowsUncheckedException',
+ 'Unchecked exceptions do not need to be declared in the method signature.'),
+ low('TryFailRefactoring',
+ 'Prefer assertThrows to try/fail'),
+ low('TypeParameterNaming',
+ 'Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter \'T\'.'),
+ low('UngroupedOverloads',
+ 'Constructors and methods with the same name should appear sequentially with no other code in between. Please re-order or re-name methods.'),
+ low('UnnecessarySetDefault',
+ 'Unnecessary call to NullPointerTester#setDefault'),
+ low('UnnecessaryStaticImport',
+ 'Using static imports for types is unnecessary'),
+ low('UseBinds',
+ '@Binds is a more efficient and declarative mechanism for delegating a binding.'),
+ low('WildcardImport',
+ 'Wildcard imports, static or otherwise, should not be used'),
+ medium('AcronymName',
+ 'AcronymName'),
+ medium('AmbiguousMethodReference',
+ 'Method reference is ambiguous'),
+ medium('AnnotateFormatMethod',
+ 'This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.'),
+ medium('AnnotationPosition',
+ 'Annotations should be positioned after Javadocs, but before modifiers..'),
+ medium('ArgumentSelectionDefectChecker',
+ 'Arguments are in the wrong order or could be commented for clarity.'),
+ medium('ArrayAsKeyOfSetOrMap',
+ 'Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs.'),
+ medium('AssertEqualsArgumentOrderChecker',
+ 'Arguments are swapped in assertEquals-like call'),
+ medium('AssertFalse',
+ 'Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead'),
+ medium('AssertThrowsMultipleStatements',
+ 'The lambda passed to assertThrows should contain exactly one statement'),
+ medium('AssertionFailureIgnored',
+ 'This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.'),
+ medium('AssistedInjectAndInjectOnConstructors',
+ '@AssistedInject and @Inject should not be used on different constructors in the same class.'),
+ medium('AutoValueFinalMethods',
+ 'Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them'),
+ medium('BadAnnotationImplementation',
+ 'Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.'),
+ medium('BadComparable',
+ 'Possible sign flip from narrowing conversion'),
+ medium('BadImport',
+ 'Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer.'),
+ medium('BadInstanceof',
+ 'instanceof used in a way that is equivalent to a null check.'),
+ medium('BigDecimalEquals',
+ 'BigDecimal#equals has surprising behavior: it also compares scale.'),
+ medium('BigDecimalLiteralDouble',
+ 'new BigDecimal(double) loses precision in this case.'),
+ medium('BinderIdentityRestoredDangerously',
+ 'A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.'),
+ medium('BindingToUnqualifiedCommonType',
+ 'This code declares a binding for a common value type without a Qualifier annotation.'),
+ medium('BoxedPrimitiveConstructor',
+ 'valueOf or autoboxing provides better time and space performance'),
+ medium('ByteBufferBackingArray',
+ 'ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().'),
+ medium('CannotMockFinalClass',
+ 'Mockito cannot mock final classes'),
+ medium('CanonicalDuration',
+ 'Duration can be expressed more clearly with different units'),
+ medium('CatchAndPrintStackTrace',
+ 'Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace'),
+ medium('CatchFail',
+ 'Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful'),
+ medium('ClassCanBeStatic',
+ 'Inner class is non-static but does not reference enclosing class'),
+ medium('ClassNewInstance',
+ 'Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance()'),
+ medium('CloseableProvides',
+ 'Providing Closeable resources makes their lifecycle unclear'),
+ medium('CollectionToArraySafeParameter',
+ 'The type of the array parameter of Collection.toArray needs to be compatible with the array type'),
+ medium('CollectorShouldNotUseState',
+ 'Collector.of() should not use state'),
+ medium('ComparableAndComparator',
+ 'Class should not implement both `Comparable` and `Comparator`'),
+ medium('ConstructorInvokesOverridable',
+ 'Constructors should not invoke overridable methods.'),
+ medium('ConstructorLeaksThis',
+ 'Constructors should not pass the \'this\' reference out in method invocations, since the object may not be fully constructed.'),
+ medium('DateFormatConstant',
+ 'DateFormat is not thread-safe, and should not be used as a constant field.'),
+ medium('DefaultCharset',
+ 'Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.'),
+ medium('DeprecatedThreadMethods',
+ 'Avoid deprecated Thread methods; read the method\'s javadoc for details.'),
+ medium('DoubleBraceInitialization',
+ 'Prefer collection factory methods or builders to the double-brace initialization pattern.'),
+ medium('DoubleCheckedLocking',
+ 'Double-checked locking on non-volatile fields is unsafe'),
+ medium('EmptyTopLevelDeclaration',
+ 'Empty top-level type declaration'),
+ medium('EqualsBrokenForNull',
+ 'equals() implementation may throw NullPointerException when given null'),
+ medium('EqualsGetClass',
+ 'Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.'),
+ medium('EqualsHashCode',
+ 'Classes that override equals should also override hashCode.'),
+ medium('EqualsIncompatibleType',
+ 'An equality test between objects with incompatible types always returns false'),
+ medium('EqualsUnsafeCast',
+ 'The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.'),
+ medium('EqualsUsingHashCode',
+ 'Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.'),
+ medium('ExpectedExceptionChecker',
+ 'Calls to ExpectedException#expect should always be followed by exactly one statement.'),
+ medium('ExtendingJUnitAssert',
+ 'When only using JUnit Assert\'s static methods, you should import statically instead of extending.'),
+ medium('FallThrough',
+ 'Switch case may fall through'),
+ medium('Finally',
+ 'If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.'),
+ medium('FloatCast',
+ 'Use parentheses to make the precedence explicit'),
+ medium('FloatingPointAssertionWithinEpsilon',
+ 'This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality.'),
+ medium('FloatingPointLiteralPrecision',
+ 'Floating point literal loses precision'),
+ medium('FragmentInjection',
+ 'Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.'),
+ medium('FragmentNotInstantiable',
+ 'Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor'),
+ medium('FunctionalInterfaceClash',
+ 'Overloads will be ambiguous when passing lambda arguments'),
+ medium('FutureReturnValueIgnored',
+ 'Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.'),
+ medium('GetClassOnEnum',
+ 'Calling getClass() on an enum may return a subclass of the enum type'),
+ medium('HardCodedSdCardPath',
+ 'Hardcoded reference to /sdcard'),
+ medium('HidingField',
+ 'Hiding fields of superclasses may cause confusion and errors'),
+ medium('ImmutableAnnotationChecker',
+ 'Annotations should always be immutable'),
+ medium('ImmutableEnumChecker',
+ 'Enums should always be immutable'),
+ medium('IncompatibleModifiers',
+ 'This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation'),
+ medium('InconsistentCapitalization',
+ 'It is confusing to have a field and a parameter under the same scope that differ only in capitalization.'),
+ medium('InconsistentHashCode',
+ 'Including fields in hashCode which are not compared in equals violates the contract of hashCode.'),
+ medium('InconsistentOverloads',
+ 'The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)'),
+ medium('IncrementInForLoopAndHeader',
+ 'This for loop increments the same variable in the header and in the body'),
+ medium('InjectOnConstructorOfAbstractClass',
+ 'Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.'),
+ medium('InputStreamSlowMultibyteRead',
+ 'Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.'),
+ medium('InstanceOfAndCastMatchWrongType',
+ 'Casting inside an if block should be plausibly consistent with the instanceof type'),
+ medium('IntLongMath',
+ 'Expression of type int may overflow before being assigned to a long'),
+ medium('IntentBuilderName',
+ 'IntentBuilderName'),
+ medium('InvalidParam',
+ 'This @param tag doesn\'t refer to a parameter of the method.'),
+ medium('InvalidTag',
+ 'This tag is invalid.'),
+ medium('InvalidThrows',
+ 'The documented method doesn\'t actually throw this checked exception.'),
+ medium('IterableAndIterator',
+ 'Class should not implement both `Iterable` and `Iterator`'),
+ medium('JUnit3FloatingPointComparisonWithoutDelta',
+ 'Floating-point comparison without error tolerance'),
+ medium('JUnit4ClassUsedInJUnit3',
+ 'Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.'),
+ medium('JUnitAmbiguousTestClass',
+ 'Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.'),
+ medium('JavaLangClash',
+ 'Never reuse class names from java.lang'),
+ medium('JdkObsolete',
+ 'Suggests alternatives to obsolete JDK classes.'),
+ medium('LockNotBeforeTry',
+ 'Calls to Lock#lock should be immediately followed by a try block which releases the lock.'),
+ medium('LogicalAssignment',
+ 'Assignment where a boolean expression was expected; use == if this assignment wasn\'t expected or add parentheses for clarity.'),
+ medium('MathAbsoluteRandom',
+ 'Math.abs does not always give a positive result. Please consider other methods for positive random numbers.'),
+ medium('MissingCasesInEnumSwitch',
+ 'Switches on enum types should either handle all values, or have a default case.'),
+ medium('MissingDefault',
+ 'The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)'),
+ medium('MissingFail',
+ 'Not calling fail() when expecting an exception masks bugs'),
+ medium('MissingOverride',
+ 'method overrides method in supertype; expected @Override'),
+ medium('ModifiedButNotUsed',
+ 'A collection or proto builder was created, but its values were never accessed.'),
+ medium('ModifyCollectionInEnhancedForLoop',
+ 'Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown.'),
+ medium('MultipleParallelOrSequentialCalls',
+ 'Multiple calls to either parallel or sequential are unnecessary and cause confusion.'),
+ medium('MutableConstantField',
+ 'Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)'),
+ medium('MutableMethodReturnType',
+ 'Method return type should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)'),
+ medium('NarrowingCompoundAssignment',
+ 'Compound assignments may hide dangerous casts'),
+ medium('NestedInstanceOfConditions',
+ 'Nested instanceOf conditions of disjoint types create blocks of code that never execute'),
+ medium('NoFunctionalReturnType',
+ 'Instead of returning a functional type, return the actual type that the returned function would return and use lambdas at use site.'),
+ medium('NonAtomicVolatileUpdate',
+ 'This update of a volatile variable is non-atomic'),
+ medium('NonCanonicalStaticMemberImport',
+ 'Static import of member uses non-canonical name'),
+ medium('NonOverridingEquals',
+ 'equals method doesn\'t override Object.equals'),
+ medium('NotCloseable',
+ 'Not closeable'),
+ medium('NullableConstructor',
+ 'Constructors should not be annotated with @Nullable since they cannot return null'),
+ medium('NullableDereference',
+ 'Dereference of possibly-null value'),
+ medium('NullablePrimitive',
+ '@Nullable should not be used for primitive types since they cannot be null'),
+ medium('NullableVoid',
+ 'void-returning methods should not be annotated with @Nullable, since they cannot return null'),
+ medium('ObjectToString',
+ 'Calling toString on Objects that don\'t override toString() doesn\'t provide useful information'),
+ medium('ObjectsHashCodePrimitive',
+ 'Objects.hashCode(Object o) should not be passed a primitive value'),
+ medium('OperatorPrecedence',
+ 'Use grouping parenthesis to make the operator precedence explicit'),
+ medium('OptionalNotPresent',
+ 'One should not call optional.get() inside an if statement that checks !optional.isPresent'),
+ medium('OrphanedFormatString',
+ 'String literal contains format specifiers, but is not passed to a format method'),
+ medium('OverrideThrowableToString',
+ 'To return a custom message with a Throwable class, one should override getMessage() instead of toString() for Throwable.'),
+ medium('Overrides',
+ 'Varargs doesn\'t agree for overridden method'),
+ medium('OverridesGuiceInjectableMethod',
+ 'This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.'),
+ medium('ParameterName',
+ 'Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter'),
+ medium('PreconditionsInvalidPlaceholder',
+ 'Preconditions only accepts the %s placeholder in error message strings'),
+ medium('PrimitiveArrayPassedToVarargsMethod',
+ 'Passing a primitive array to a varargs method is usually wrong'),
+ medium('ProtoRedundantSet',
+ 'A field on a protocol buffer was set twice in the same chained expression.'),
+ medium('ProtosAsKeyOfSetOrMap',
+ 'Protos should not be used as a key to a map, in a set, or in a contains method on a descendant of a collection. Protos have non deterministic ordering and proto equality is deep, which is a performance issue.'),
+ medium('ProvidesFix',
+ 'BugChecker has incorrect ProvidesFix tag, please update'),
+ medium('QualifierOrScopeOnInjectMethod',
+ 'Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.'),
+ medium('QualifierWithTypeUse',
+ 'Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.'),
+ medium('ReachabilityFenceUsage',
+ 'reachabilityFence should always be called inside a finally block'),
+ medium('RedundantThrows',
+ 'Thrown exception is a subtype of another'),
+ medium('ReferenceEquality',
+ 'Comparison using reference equality instead of value equality'),
+ medium('RequiredModifiers',
+ 'This annotation is missing required modifiers as specified by its @RequiredModifiers annotation'),
+ medium('ReturnFromVoid',
+ 'Void methods should not have a @return tag.'),
+ medium('SamShouldBeLast',
+ 'SAM-compatible parameters should be last'),
+ medium('ShortCircuitBoolean',
+ u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.'),
+ medium('StaticGuardedByInstance',
+ 'Writes to static fields should not be guarded by instance locks'),
+ medium('StaticQualifiedUsingExpression',
+ 'A static variable or method should be qualified with a class name, not expression'),
+ medium('StreamResourceLeak',
+ 'Streams that encapsulate a closeable resource should be closed using try-with-resources'),
+ medium('StringEquality',
+ 'String comparison using reference equality instead of value equality'),
+ medium('StringSplitter',
+ 'String.split(String) has surprising behavior'),
+ medium('SwigMemoryLeak',
+ 'SWIG generated code that can\'t call a C++ destructor will leak memory'),
+ medium('SynchronizeOnNonFinalField',
+ 'Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.'),
+ medium('SystemExitOutsideMain',
+ 'Code that contains System.exit() is untestable.'),
+ medium('TestExceptionChecker',
+ 'Using @Test(expected=...) is discouraged, since the test will pass if *any* statement in the test method throws the expected exception'),
+ medium('ThreadJoinLoop',
+ 'Thread.join needs to be surrounded by a loop until it succeeds, as in Uninterruptibles.joinUninterruptibly.'),
+ medium('ThreadLocalUsage',
+ 'ThreadLocals should be stored in static fields'),
+ medium('ThreadPriorityCheck',
+ 'Relying on the thread scheduler is discouraged; see Effective Java Item 72 (2nd edition) / 84 (3rd edition).'),
+ medium('ThreeLetterTimeZoneID',
+ 'Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead.'),
+ medium('ToStringReturnsNull',
+ 'An implementation of Object.toString() should never return null.'),
+ medium('TruthAssertExpected',
+ 'The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.'),
+ medium('TruthConstantAsserts',
+ 'Truth Library assert is called on a constant.'),
+ medium('TruthIncompatibleType',
+ 'Argument is not compatible with the subject\'s type.'),
+ medium('TypeNameShadowing',
+ 'Type parameter declaration shadows another named type'),
+ medium('TypeParameterShadowing',
+ 'Type parameter declaration overrides another type parameter already declared'),
+ medium('TypeParameterUnusedInFormals',
+ 'Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.'),
+ medium('URLEqualsHashCode',
+ 'Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.'),
+ medium('UndefinedEquals',
+ 'Collection, Iterable, Multimap, and Queue do not have well-defined equals behavior'),
+ medium('UnnecessaryDefaultInEnumSwitch',
+ 'Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.'),
+ medium('UnnecessaryParentheses',
+ 'Unnecessary use of grouping parentheses'),
+ medium('UnsafeFinalization',
+ 'Finalizer may run before native code finishes execution'),
+ medium('UnsafeReflectiveConstructionCast',
+ 'Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor.'),
+ medium('UnsynchronizedOverridesSynchronized',
+ 'Unsynchronized method overrides a synchronized method.'),
+ medium('Unused',
+ 'Unused.'),
+ medium('UnusedException',
+ 'This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder.'),
+ medium('UseCorrectAssertInTests',
+ 'Java assert is used in test. For testing purposes Assert.* matchers should be used.'),
+ medium('UserHandle',
+ 'UserHandle'),
+ medium('UserHandleName',
+ 'UserHandleName'),
+ medium('Var',
+ 'Non-constant variable missing @Var annotation'),
+ medium('VariableNameSameAsType',
+ 'variableName and type with the same name would refer to the static field instead of the class'),
+ medium('WaitNotInLoop',
+ 'Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop'),
+ medium('WakelockReleasedDangerously',
+ 'A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.'),
+ java_medium('Found raw type',
+ [r'.*\.java:.*: warning: \[rawtypes\] found raw type']),
+ java_medium('Redundant cast',
+ [r'.*\.java:.*: warning: \[cast\] redundant cast to']),
+ java_medium('Static method should be qualified',
+ [r'.*\.java:.*: warning: \[static\] static method should be qualified']),
+ medium('AbstractInner'),
+ medium('CallbackName'),
+ medium('ExecutorRegistration'),
+ medium('JavaApiUsedByMainlineModule'),
+ medium('ListenerLast'),
+ medium('MissingBuildMethod'),
+ medium('NoByteOrShort'),
+ medium('OverlappingConstants'),
+ medium('SetterReturnsThis'),
+ medium('Typo'),
+ medium('UseIcu'),
+ high('AndroidInjectionBeforeSuper',
+ 'AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()'),
+ high('AndroidJdkLibsChecker',
+ 'Use of class, field, or method that is not compatible with legacy Android devices'),
+ high('ArrayEquals',
+ 'Reference equality used to compare arrays'),
+ high('ArrayFillIncompatibleType',
+ 'Arrays.fill(Object[], Object) called with incompatible types.'),
+ high('ArrayHashCode',
+ 'hashcode method on array does not hash array contents'),
+ high('ArrayReturn',
+ 'ArrayReturn'),
+ high('ArrayToString',
+ 'Calling toString on an array does not provide useful information'),
+ high('ArraysAsListPrimitiveArray',
+ 'Arrays.asList does not autobox primitive arrays, as one might expect.'),
+ high('AssistedInjectAndInjectOnSameConstructor',
+ '@AssistedInject and @Inject cannot be used on the same constructor.'),
+ high('AsyncCallableReturnsNull',
+ 'AsyncCallable should not return a null Future, only a Future whose result is null.'),
+ high('AsyncFunctionReturnsNull',
+ 'AsyncFunction should not return a null Future, only a Future whose result is null.'),
+ high('AutoFactoryAtInject',
+ '@AutoFactory and @Inject should not be used in the same type.'),
+ high('AutoValueConstructorOrderChecker',
+ 'Arguments to AutoValue constructor are in the wrong order'),
+ high('BadShiftAmount',
+ 'Shift by an amount that is out of range'),
+ high('BundleDeserializationCast',
+ 'Object serialized in Bundle may have been flattened to base type.'),
+ high('ChainingConstructorIgnoresParameter',
+ 'The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.'),
+ high('CheckReturnValue',
+ 'Ignored return value of method that is annotated with @CheckReturnValue'),
+ high('ClassName',
+ 'The source file name should match the name of the top-level class it contains'),
+ high('CollectionIncompatibleType',
+ 'Incompatible type as argument to Object-accepting Java collections method'),
+ high('ComparableType',
+ u'Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.'),
+ high('ComparingThisWithNull',
+ 'this == null is always false, this != null is always true'),
+ high('ComparisonContractViolated',
+ 'This comparison method violates the contract'),
+ high('ComparisonOutOfRange',
+ 'Comparison to value that is out of range for the compared type'),
+ high('CompatibleWithAnnotationMisuse',
+ '@CompatibleWith\'s value is not a type argument.'),
+ high('CompileTimeConstant',
+ 'Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.'),
+ high('ComplexBooleanConstant',
+ 'Non-trivial compile time constant boolean expressions shouldn\'t be used.'),
+ high('ConditionalExpressionNumericPromotion',
+ 'A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression\'s result may not be of the expected type.'),
+ high('ConstantOverflow',
+ 'Compile-time constant expression overflows'),
+ high('DaggerProvidesNull',
+ 'Dagger @Provides methods may not return null unless annotated with @Nullable'),
+ high('DeadException',
+ 'Exception created but not thrown'),
+ high('DeadThread',
+ 'Thread created but not started'),
java_high('Deprecated item is not annotated with @Deprecated',
[r".*\.java:.*: warning: \[.*\] .+ is not annotated with @Deprecated$"]),
- java_high('Division by integer literal zero',
- [r".*: warning: \[DivZero\] .+"]),
- java_high('This method should not be called.',
- [r".*: warning: \[DoNotCall\] .+"]),
- java_high('Empty statement after if',
- [r".*: warning: \[EmptyIf\] .+"]),
- java_high('== NaN always returns false; use the isNaN methods instead',
- [r".*: warning: \[EqualsNaN\] .+"]),
- java_high('== must be used in equals method to check equality to itself or an infinite loop will occur.',
- [r".*: warning: \[EqualsReference\] .+"]),
- java_high('Comparing different pairs of fields/getters in an equals implementation is probably a mistake.',
- [r".*: warning: \[EqualsWrongThing\] .+"]),
- java_high('Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method',
- [r".*: warning: \[ForOverride\] .+"]),
- java_high('Invalid printf-style format string',
- [r".*: warning: \[FormatString\] .+"]),
- java_high('Invalid format string passed to formatting method.',
- [r".*: warning: \[FormatStringAnnotation\] .+"]),
- java_high('Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.',
- [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]),
- java_high('Futures.getChecked requires a checked exception type with a standard constructor.',
- [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]),
- java_high('DoubleMath.fuzzyEquals should never be used in an Object.equals() method',
- [r".*: warning: \[FuzzyEqualsShouldNotBeUsedInEqualsMethod\] .+"]),
- java_high('Calling getClass() on an annotation may return a proxy class',
- [r".*: warning: \[GetClassOnAnnotation\] .+"]),
- java_high('Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly',
- [r".*: warning: \[GetClassOnClass\] .+"]),
- java_high('Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
- [r".*: warning: \[GuardedBy\] .+"]),
- java_high('Scope annotation on implementation class of AssistedInject factory is not allowed',
- [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]),
- java_high('A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
- [r".*: warning: \[GuiceAssistedParameters\] .+"]),
- java_high('Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
- [r".*: warning: \[GuiceInjectOnFinalField\] .+"]),
- java_high('contains() is a legacy method that is equivalent to containsValue()',
- [r".*: warning: \[HashtableContains\] .+"]),
- java_high('A binary expression where both operands are the same is usually incorrect.',
- [r".*: warning: \[IdentityBinaryExpression\] .+"]),
- java_high('Type declaration annotated with @Immutable is not immutable',
- [r".*: warning: \[Immutable\] .+"]),
- java_high('Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
- [r".*: warning: \[ImmutableModification\] .+"]),
- java_high('Passing argument to a generic method with an incompatible type.',
- [r".*: warning: \[IncompatibleArgumentType\] .+"]),
- java_high('The first argument to indexOf is a Unicode code point, and the second is the index to start the search from',
- [r".*: warning: \[IndexOfChar\] .+"]),
- java_high('Conditional expression in varargs call contains array and non-array arguments',
- [r".*: warning: \[InexactVarargsConditional\] .+"]),
- java_high('This method always recurses, and will cause a StackOverflowError',
- [r".*: warning: \[InfiniteRecursion\] .+"]),
- java_high('A scoping annotation\'s Target should include TYPE and METHOD.',
- [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]),
- java_high('Using more than one qualifier annotation on the same element is not allowed.',
- [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]),
- java_high('A class can be annotated with at most one scope annotation.',
- [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]),
- java_high('Members shouldn\'t be annotated with @Inject if constructor is already annotated @Inject',
- [r".*: warning: \[InjectOnMemberAndConstructor\] .+"]),
- java_high('Scope annotation on an interface or abstact class is not allowed',
- [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]),
- java_high('Scoping and qualifier annotations must have runtime retention.',
- [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]),
- java_high('Injected constructors cannot be optional nor have binding annotations',
- [r".*: warning: \[InjectedConstructorAnnotations\] .+"]),
- java_high('A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
- [r".*: warning: \[InsecureCryptoUsage\] .+"]),
- java_high('Invalid syntax used for a regular expression',
- [r".*: warning: \[InvalidPatternSyntax\] .+"]),
- java_high('Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended.',
- [r".*: warning: \[InvalidTimeZoneID\] .+"]),
- java_high('The argument to Class#isInstance(Object) should not be a Class',
- [r".*: warning: \[IsInstanceOfClass\] .+"]),
- java_high('Log tag too long, cannot exceed 23 characters.',
- [r".*: warning: \[IsLoggableTagLength\] .+"]),
- java_high(u'Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
- [r".*: warning: \[IterablePathParameter\] .+"]),
- java_high('jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation',
- [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]),
- java_high('Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").',
- [r".*: warning: \[JUnit3TestNotRun\] .+"]),
- java_high('This method should be static',
- [r".*: warning: \[JUnit4ClassAnnotationNonStatic\] .+"]),
- java_high('setUp() method will not be run; please add JUnit\'s @Before annotation',
- [r".*: warning: \[JUnit4SetUpNotRun\] .+"]),
- java_high('tearDown() method will not be run; please add JUnit\'s @After annotation',
- [r".*: warning: \[JUnit4TearDownNotRun\] .+"]),
- java_high('This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.',
- [r".*: warning: \[JUnit4TestNotRun\] .+"]),
- java_high('An object is tested for reference equality to itself using JUnit library.',
- [r".*: warning: \[JUnitAssertSameCheck\] .+"]),
- java_high('Use of class, field, or method that is not compatible with JDK 7',
- [r".*: warning: \[Java7ApiChecker\] .+"]),
- java_high('Abstract and default methods are not injectable with javax.inject.Inject',
- [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]),
- java_high('@javax.inject.Inject cannot be put on a final field.',
- [r".*: warning: \[JavaxInjectOnFinalField\] .+"]),
- java_high('This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly',
- [r".*: warning: \[LiteByteStringUtf8\] .+"]),
- java_high('This method does not acquire the locks specified by its @LockMethod annotation',
- [r".*: warning: \[LockMethodChecker\] .+"]),
- java_high('Prefer \'L\' to \'l\' for the suffix to long literals',
- [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]),
- java_high('Loop condition is never modified in loop body.',
- [r".*: warning: \[LoopConditionChecker\] .+"]),
- java_high('Math.round(Integer) results in truncation',
- [r".*: warning: \[MathRoundIntLong\] .+"]),
- java_high('Certain resources in `android.R.string` have names that do not match their content',
- [r".*: warning: \[MislabeledAndroidString\] .+"]),
- java_high('Overriding method is missing a call to overridden super method',
- [r".*: warning: \[MissingSuperCall\] .+"]),
- java_high('A terminating method call is required for a test helper to have any effect.',
- [r".*: warning: \[MissingTestCall\] .+"]),
- java_high('Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
- [r".*: warning: \[MisusedWeekYear\] .+"]),
- java_high('A bug in Mockito will cause this test to fail at runtime with a ClassCastException',
- [r".*: warning: \[MockitoCast\] .+"]),
- java_high('Missing method call for verify(mock) here',
- [r".*: warning: \[MockitoUsage\] .+"]),
- java_high('Using a collection function with itself as the argument.',
- [r".*: warning: \[ModifyingCollectionWithItself\] .+"]),
- java_high('This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
- [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]),
- java_high('The result of this method must be closed.',
- [r".*: warning: \[MustBeClosedChecker\] .+"]),
- java_high('The first argument to nCopies is the number of copies, and the second is the item to copy',
- [r".*: warning: \[NCopiesOfChar\] .+"]),
- java_high('@NoAllocation was specified on this method, but something was found that would trigger an allocation',
- [r".*: warning: \[NoAllocation\] .+"]),
- java_high('Static import of type uses non-canonical name',
- [r".*: warning: \[NonCanonicalStaticImport\] .+"]),
- java_high('@CompileTimeConstant parameters should be final or effectively final',
- [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]),
- java_high('Calling getAnnotation on an annotation that is not retained at runtime.',
- [r".*: warning: \[NonRuntimeAnnotation\] .+"]),
- java_high('This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.',
- [r".*: warning: \[NullTernary\] .+"]),
- java_high('Numeric comparison using reference equality instead of value equality',
- [r".*: warning: \[NumericEquality\] .+"]),
- java_high('Comparison using reference equality instead of value equality',
- [r".*: warning: \[OptionalEquality\] .+"]),
- java_high('Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
- [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]),
- java_high('This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.',
- [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]),
- java_high('Declaring types inside package-info.java files is very bad form',
- [r".*: warning: \[PackageInfo\] .+"]),
- java_high('Method parameter has wrong package',
- [r".*: warning: \[ParameterPackage\] .+"]),
- java_high('Detects classes which implement Parcelable but don\'t have CREATOR',
- [r".*: warning: \[ParcelableCreator\] .+"]),
- java_high('Literal passed as first argument to Preconditions.checkNotNull() can never be null',
- [r".*: warning: \[PreconditionsCheckNotNull\] .+"]),
- java_high('First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference',
- [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]),
- java_high('Using ::equals or ::isInstance as an incompatible Predicate; the predicate will always return false',
- [r".*: warning: \[PredicateIncompatibleType\] .+"]),
- java_high('Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.',
- [r".*: warning: \[PrivateSecurityContractProtoAccess\] .+"]),
- java_high('Protobuf fields cannot be null.',
- [r".*: warning: \[ProtoFieldNullComparison\] .+"]),
- java_high('Comparing protobuf fields of type String using reference equality',
- [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]),
- java_high('To get the tag number of a protocol buffer enum, use getNumber() instead.',
- [r".*: warning: \[ProtocolBufferOrdinal\] .+"]),
- java_high('@Provides methods need to be declared in a Module to have any effect.',
- [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]),
- java_high('Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.',
- [r".*: warning: \[RandomCast\] .+"]),
- java_high('Use Random.nextInt(int). Random.nextInt() % n can have negative results',
- [r".*: warning: \[RandomModInteger\] .+"]),
- java_high('Return value of android.graphics.Rect.intersect() must be checked',
- [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]),
- java_high('Use of method or class annotated with @RestrictTo',
- [r".*: warning: \[RestrictTo\] .+"]),
- java_high(' Check for non-whitelisted callers to RestrictedApiChecker.',
- [r".*: warning: \[RestrictedApiChecker\] .+"]),
- java_high('Return value of this method must be used',
- [r".*: warning: \[ReturnValueIgnored\] .+"]),
- java_high('Variable assigned to itself',
- [r".*: warning: \[SelfAssignment\] .+"]),
- java_high('An object is compared to itself',
- [r".*: warning: \[SelfComparison\] .+"]),
- java_high('Testing an object for equality with itself will always be true.',
- [r".*: warning: \[SelfEquals\] .+"]),
- java_high('This method must be called with an even number of arguments.',
- [r".*: warning: \[ShouldHaveEvenArgs\] .+"]),
- java_high('Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?',
- [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]),
- java_high('Static and default interface methods are not natively supported on older Android devices. ',
- [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]),
- java_high('Calling toString on a Stream does not provide useful information',
- [r".*: warning: \[StreamToString\] .+"]),
- java_high('StringBuilder does not have a char constructor; this invokes the int constructor.',
- [r".*: warning: \[StringBuilderInitWithChar\] .+"]),
- java_high('String.substring(0) returns the original String',
- [r".*: warning: \[SubstringOfZero\] .+"]),
- java_high('Suppressing "deprecated" is probably a typo for "deprecation"',
- [r".*: warning: \[SuppressWarningsDeprecated\] .+"]),
- java_high('throwIfUnchecked(knownCheckedException) is a no-op.',
- [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]),
- java_high('Throwing \'null\' always results in a NullPointerException being thrown.',
- [r".*: warning: \[ThrowNull\] .+"]),
- java_high('isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.',
- [r".*: warning: \[TruthSelfEquals\] .+"]),
- java_high('Catching Throwable/Error masks failures from fail() or assert*() in the try block',
- [r".*: warning: \[TryFailThrowable\] .+"]),
- java_high('Type parameter used as type qualifier',
- [r".*: warning: \[TypeParameterQualifier\] .+"]),
- java_high('This method does not acquire the locks specified by its @UnlockMethod annotation',
- [r".*: warning: \[UnlockMethod\] .+"]),
- java_high('Non-generic methods should not be invoked with type arguments',
- [r".*: warning: \[UnnecessaryTypeArgument\] .+"]),
- java_high('Instance created but never used',
- [r".*: warning: \[UnusedAnonymousClass\] .+"]),
- java_high('Collection is modified in place, but the result is not used',
- [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]),
- java_high('`var` should not be used as a type name.',
- [r".*: warning: \[VarTypeName\] .+"]),
+ high('DivZero',
+ 'Division by integer literal zero'),
+ high('DoNotCall',
+ 'This method should not be called.'),
+ high('EmptyIf',
+ 'Empty statement after if'),
+ high('EqualsNaN',
+ '== NaN always returns false; use the isNaN methods instead'),
+ high('EqualsReference',
+ '== must be used in equals method to check equality to itself or an infinite loop will occur.'),
+ high('EqualsWrongThing',
+ 'Comparing different pairs of fields/getters in an equals implementation is probably a mistake.'),
+ high('ForOverride',
+ 'Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method'),
+ high('FormatString',
+ 'Invalid printf-style format string'),
+ high('FormatStringAnnotation',
+ 'Invalid format string passed to formatting method.'),
+ high('FunctionalInterfaceMethodChanged',
+ 'Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.'),
+ high('FuturesGetCheckedIllegalExceptionType',
+ 'Futures.getChecked requires a checked exception type with a standard constructor.'),
+ high('FuzzyEqualsShouldNotBeUsedInEqualsMethod',
+ 'DoubleMath.fuzzyEquals should never be used in an Object.equals() method'),
+ high('GetClassOnAnnotation',
+ 'Calling getClass() on an annotation may return a proxy class'),
+ high('GetClassOnClass',
+ 'Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly'),
+ high('GuardedBy',
+ 'Checks for unguarded accesses to fields and methods with @GuardedBy annotations'),
+ high('GuiceAssistedInjectScoping',
+ 'Scope annotation on implementation class of AssistedInject factory is not allowed'),
+ high('GuiceAssistedParameters',
+ 'A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.'),
+ high('GuiceInjectOnFinalField',
+ 'Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.'),
+ high('HashtableContains',
+ 'contains() is a legacy method that is equivalent to containsValue()'),
+ high('IdentityBinaryExpression',
+ 'A binary expression where both operands are the same is usually incorrect.'),
+ high('Immutable',
+ 'Type declaration annotated with @Immutable is not immutable'),
+ high('ImmutableModification',
+ 'Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified'),
+ high('IncompatibleArgumentType',
+ 'Passing argument to a generic method with an incompatible type.'),
+ high('IndexOfChar',
+ 'The first argument to indexOf is a Unicode code point, and the second is the index to start the search from'),
+ high('InexactVarargsConditional',
+ 'Conditional expression in varargs call contains array and non-array arguments'),
+ high('InfiniteRecursion',
+ 'This method always recurses, and will cause a StackOverflowError'),
+ high('InjectInvalidTargetingOnScopingAnnotation',
+ 'A scoping annotation\'s Target should include TYPE and METHOD.'),
+ high('InjectMoreThanOneQualifier',
+ 'Using more than one qualifier annotation on the same element is not allowed.'),
+ high('InjectMoreThanOneScopeAnnotationOnClass',
+ 'A class can be annotated with at most one scope annotation.'),
+ high('InjectOnMemberAndConstructor',
+ 'Members shouldn\'t be annotated with @Inject if constructor is already annotated @Inject'),
+ high('InjectScopeAnnotationOnInterfaceOrAbstractClass',
+ 'Scope annotation on an interface or abstact class is not allowed'),
+ high('InjectScopeOrQualifierAnnotationRetention',
+ 'Scoping and qualifier annotations must have runtime retention.'),
+ high('InjectedConstructorAnnotations',
+ 'Injected constructors cannot be optional nor have binding annotations'),
+ high('InsecureCryptoUsage',
+ 'A standard cryptographic operation is used in a mode that is prone to vulnerabilities'),
+ high('InvalidPatternSyntax',
+ 'Invalid syntax used for a regular expression'),
+ high('InvalidTimeZoneID',
+ 'Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended.'),
+ high('IsInstanceOfClass',
+ 'The argument to Class#isInstance(Object) should not be a Class'),
+ high('IsLoggableTagLength',
+ 'Log tag too long, cannot exceed 23 characters.'),
+ high('IterablePathParameter',
+ u'Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity'),
+ high('JMockTestWithoutRunWithOrRuleAnnotation',
+ 'jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation'),
+ high('JUnit3TestNotRun',
+ 'Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").'),
+ high('JUnit4ClassAnnotationNonStatic',
+ 'This method should be static'),
+ high('JUnit4SetUpNotRun',
+ 'setUp() method will not be run; please add JUnit\'s @Before annotation'),
+ high('JUnit4TearDownNotRun',
+ 'tearDown() method will not be run; please add JUnit\'s @After annotation'),
+ high('JUnit4TestNotRun',
+ 'This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.'),
+ high('JUnitAssertSameCheck',
+ 'An object is tested for reference equality to itself using JUnit library.'),
+ high('Java7ApiChecker',
+ 'Use of class, field, or method that is not compatible with JDK 7'),
+ high('JavaxInjectOnAbstractMethod',
+ 'Abstract and default methods are not injectable with javax.inject.Inject'),
+ high('JavaxInjectOnFinalField',
+ '@javax.inject.Inject cannot be put on a final field.'),
+ high('LiteByteStringUtf8',
+ 'This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly'),
+ high('LockMethodChecker',
+ 'This method does not acquire the locks specified by its @LockMethod annotation'),
+ high('LongLiteralLowerCaseSuffix',
+ 'Prefer \'L\' to \'l\' for the suffix to long literals'),
+ high('LoopConditionChecker',
+ 'Loop condition is never modified in loop body.'),
+ high('MathRoundIntLong',
+ 'Math.round(Integer) results in truncation'),
+ high('MislabeledAndroidString',
+ 'Certain resources in `android.R.string` have names that do not match their content'),
+ high('MissingSuperCall',
+ 'Overriding method is missing a call to overridden super method'),
+ high('MissingTestCall',
+ 'A terminating method call is required for a test helper to have any effect.'),
+ high('MisusedWeekYear',
+ 'Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.'),
+ high('MockitoCast',
+ 'A bug in Mockito will cause this test to fail at runtime with a ClassCastException'),
+ high('MockitoUsage',
+ 'Missing method call for verify(mock) here'),
+ high('ModifyingCollectionWithItself',
+ 'Using a collection function with itself as the argument.'),
+ high('MoreThanOneInjectableConstructor',
+ 'This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.'),
+ high('MustBeClosedChecker',
+ 'The result of this method must be closed.'),
+ high('NCopiesOfChar',
+ 'The first argument to nCopies is the number of copies, and the second is the item to copy'),
+ high('NoAllocation',
+ '@NoAllocation was specified on this method, but something was found that would trigger an allocation'),
+ high('NonCanonicalStaticImport',
+ 'Static import of type uses non-canonical name'),
+ high('NonFinalCompileTimeConstant',
+ '@CompileTimeConstant parameters should be final or effectively final'),
+ high('NonRuntimeAnnotation',
+ 'Calling getAnnotation on an annotation that is not retained at runtime.'),
+ high('NullTernary',
+ 'This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.'),
+ high('NumericEquality',
+ 'Numeric comparison using reference equality instead of value equality'),
+ high('OptionalEquality',
+ 'Comparison using reference equality instead of value equality'),
+ high('OverlappingQualifierAndScopeAnnotation',
+ 'Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.'),
+ high('OverridesJavaxInjectableMethod',
+ 'This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.'),
+ high('PackageInfo',
+ 'Declaring types inside package-info.java files is very bad form'),
+ high('ParameterPackage',
+ 'Method parameter has wrong package'),
+ high('ParcelableCreator',
+ 'Detects classes which implement Parcelable but don\'t have CREATOR'),
+ high('PreconditionsCheckNotNull',
+ 'Literal passed as first argument to Preconditions.checkNotNull() can never be null'),
+ high('PreconditionsCheckNotNullPrimitive',
+ 'First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference'),
+ high('PredicateIncompatibleType',
+ 'Using ::equals or ::isInstance as an incompatible Predicate; the predicate will always return false'),
+ high('PrivateSecurityContractProtoAccess',
+ 'Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.'),
+ high('ProtoFieldNullComparison',
+ 'Protobuf fields cannot be null.'),
+ high('ProtoStringFieldReferenceEquality',
+ 'Comparing protobuf fields of type String using reference equality'),
+ high('ProtocolBufferOrdinal',
+ 'To get the tag number of a protocol buffer enum, use getNumber() instead.'),
+ high('ProvidesMethodOutsideOfModule',
+ '@Provides methods need to be declared in a Module to have any effect.'),
+ high('RandomCast',
+ 'Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.'),
+ high('RandomModInteger',
+ 'Use Random.nextInt(int). Random.nextInt() % n can have negative results'),
+ high('RectIntersectReturnValueIgnored',
+ 'Return value of android.graphics.Rect.intersect() must be checked'),
+ high('RestrictTo',
+ 'Use of method or class annotated with @RestrictTo'),
+ high('RestrictedApiChecker',
+ ' Check for non-whitelisted callers to RestrictedApiChecker.'),
+ high('ReturnValueIgnored',
+ 'Return value of this method must be used'),
+ high('SelfAssignment',
+ 'Variable assigned to itself'),
+ high('SelfComparison',
+ 'An object is compared to itself'),
+ high('SelfEquals',
+ 'Testing an object for equality with itself will always be true.'),
+ high('ShouldHaveEvenArgs',
+ 'This method must be called with an even number of arguments.'),
+ high('SizeGreaterThanOrEqualsZero',
+ 'Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?'),
+ high('StaticOrDefaultInterfaceMethod',
+ 'Static and default interface methods are not natively supported on older Android devices. '),
+ high('StreamToString',
+ 'Calling toString on a Stream does not provide useful information'),
+ high('StringBuilderInitWithChar',
+ 'StringBuilder does not have a char constructor; this invokes the int constructor.'),
+ high('SubstringOfZero',
+ 'String.substring(0) returns the original String'),
+ high('SuppressWarningsDeprecated',
+ 'Suppressing "deprecated" is probably a typo for "deprecation"'),
+ high('ThrowIfUncheckedKnownChecked',
+ 'throwIfUnchecked(knownCheckedException) is a no-op.'),
+ high('ThrowNull',
+ 'Throwing \'null\' always results in a NullPointerException being thrown.'),
+ high('TruthSelfEquals',
+ 'isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.'),
+ high('TryFailThrowable',
+ 'Catching Throwable/Error masks failures from fail() or assert*() in the try block'),
+ high('TypeParameterQualifier',
+ 'Type parameter used as type qualifier'),
+ high('UnlockMethod',
+ 'This method does not acquire the locks specified by its @UnlockMethod annotation'),
+ high('UnnecessaryTypeArgument',
+ 'Non-generic methods should not be invoked with type arguments'),
+ high('UnusedAnonymousClass',
+ 'Instance created but never used'),
+ high('UnusedCollectionModifiedInPlace',
+ 'Collection is modified in place, but the result is not used'),
+ high('VarTypeName',
+ '`var` should not be used as a type name.'),
+
# Other javac tool warnings
java_medium('addNdkApiCoverage failed to getPackage',
[r".*: warning: addNdkApiCoverage failed to getPackage"]),
diff --git a/tools/warn/make_warn_patterns.py b/tools/warn/make_warn_patterns.py
index 327fce4..dd6a1b0 100644
--- a/tools/warn/make_warn_patterns.py
+++ b/tools/warn/make_warn_patterns.py
@@ -53,6 +53,9 @@
{'category': 'make', 'severity': Severity.MEDIUM,
'description': 'make: please convert to soong',
'patterns': [r".*: warning: .* has been deprecated. Please convert to Soong."]},
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'make: deprecated macros',
+ 'patterns': [r".*\.mk:.* warning:.* [A-Z_]+ (is|has been) deprecated."]},
]
diff --git a/tools/warn/other_warn_patterns.py b/tools/warn/other_warn_patterns.py
index 19a4e38..1350936 100644
--- a/tools/warn/other_warn_patterns.py
+++ b/tools/warn/other_warn_patterns.py
@@ -112,10 +112,20 @@
kotlin('never used parameter or variable',
[r".*\.kt:.*: warning: (parameter|variable) '.*' is never used$",
r".*\.kt:.*: warning: (parameter|variable) '.*' is never used, could be renamed to _$"]),
+ kotlin('initializer is redundant',
+ [r".*\.kt:.*: warning: .* initializer is redundant$"]),
+ kotlin('elvis operator always returns ...',
+ [r".*\.kt:.*: warning: elvis operator \(\?:\) always returns .+"]),
+ kotlin('shadowed name',
+ [r".*\.kt:.*: warning: name shadowed: .+"]),
kotlin('unchecked cast',
[r".*\.kt:.*: warning: unchecked cast: .* to .*$"]),
+ kotlin('unnecessary safe call on a non-null receiver',
+ [r".*\.kt:.*: warning: unnecessary safe call on a non-null receiver"]),
kotlin('Deprecated in Java',
[r".*\.kt:.*: warning: '.*' is deprecated. Deprecated in Java"]),
+ kotlin('Replacing Handler for Executor',
+ [r".*\.kt:.*: warning: .+ Replacing Handler for Executor in "]),
kotlin('library has Kotlin runtime',
[r".*: warning: library has Kotlin runtime bundled into it",
r".*: warning: some JAR files .* have the Kotlin Runtime library"]),