Merge "Add support for creating ext4 images with mke2fs"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index a3b5f3c..8087646 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -377,6 +377,8 @@
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/previous_overlays.txt)
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/current_packages.txt)
+$(call add-clean-step, rm -rf $(HOST_OUT_INTERMEDIATES)/include)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 9bfb4ea..8f63f4a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1666,6 +1666,7 @@
$(HOST_OUT_EXECUTABLES)/e2fsck \
$(HOST_OUT_EXECUTABLES)/build_verity_tree \
$(HOST_OUT_EXECUTABLES)/verity_signer \
+ $(HOST_OUT_EXECUTABLES)/verity_verifier \
$(HOST_OUT_EXECUTABLES)/append2simg \
$(HOST_OUT_EXECUTABLES)/img2simg \
$(HOST_OUT_EXECUTABLES)/boot_signer \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 13d20e0..251ac35 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -65,6 +65,8 @@
my_host_cross :=
endif
+include $(BUILD_SYSTEM)/local_vndk.mk
+
my_module_tags := $(LOCAL_MODULE_TAGS)
ifeq ($(my_host_cross),true)
my_module_tags :=
diff --git a/core/binary.mk b/core/binary.mk
index c11ed32f..17b1bf2 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -74,8 +74,9 @@
my_ndk_sysroot :=
my_ndk_sysroot_include :=
my_ndk_sysroot_lib :=
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
ifdef LOCAL_IS_HOST_MODULE
+ # LOCAL_USE_VNDK is checked in local_vndk.mk
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
endif
@@ -104,17 +105,33 @@
# missing API levels to existing ones where necessary, but we're not doing
# that for the generated libraries. Clip the API level to the minimum where
# appropriate.
- my_ndk_api := $(call math_max,$(LOCAL_SDK_VERSION),$(my_min_sdk_version))
+ ifdef LOCAL_USE_VNDK
+ my_ndk_api := $(BOARD_VNDK_VERSION)
+ else
+ my_ndk_api := $(LOCAL_SDK_VERSION)
+ endif
+ ifneq ($(my_ndk_api),current)
+ my_ndk_api := $(call math_max,$(my_ndk_api),$(my_min_sdk_version))
+ endif
+
+ my_ndk_api_def := $(my_ndk_api)
+ my_ndk_hist_api := $(my_ndk_api)
+ ifeq ($(my_ndk_api),current)
+ my_ndk_api_def := __ANDROID_API_FUTURE__
+ # The last API level supported by the old prebuilt NDKs.
+ my_ndk_hist_api := 24
+ endif
+
# Traditionally this has come from android/api-level.h, but with the libc
# headers unified it must be set by the build system since we don't have
# per-API level copies of that header now.
- my_cflags += -D__ANDROID_API__=$(my_ndk_api)
+ my_cflags += -D__ANDROID_API__=$(my_ndk_api_def)
my_ndk_source_root := \
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
my_ndk_sysroot := \
- $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_api)/arch-$(my_arch)
+ $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_hist_api)/arch-$(my_arch)
my_built_ndk := $(SOONG_OUT_DIR)/ndk
my_ndk_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_TRIPLE)
my_ndk_sysroot_include := \
@@ -142,18 +159,20 @@
my_built_ndk_libs := $(my_ndk_platform_dir)/usr/$(my_ndk_libdir_name)
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/$(my_ndk_libdir_name)
- # The bionic linker now has support for packed relocations and gnu style
- # hashes (which are much faster!), but shipping to older devices requires
- # the old style hash. Fortunately, we can build with both and it'll work
- # anywhere.
- #
- # This is not currently supported on MIPS architectures.
- ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
- my_ldflags += -Wl,--hash-style=both
- endif
+ ifndef LOCAL_USE_VNDK
+ # The bionic linker now has support for packed relocations and gnu style
+ # hashes (which are much faster!), but shipping to older devices requires
+ # the old style hash. Fortunately, we can build with both and it'll work
+ # anywhere.
+ #
+ # This is not currently supported on MIPS architectures.
+ ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
+ my_ldflags += -Wl,--hash-style=both
+ endif
- # We don't want to expose the relocation packer to the NDK just yet.
- LOCAL_PACK_MODULE_RELOCATIONS := false
+ # We don't want to expose the relocation packer to the NDK just yet.
+ LOCAL_PACK_MODULE_RELOCATIONS := false
+ endif
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
# See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -161,6 +180,7 @@
my_ndk_stl_shared_lib_fullpath :=
my_ndk_stl_static_lib :=
my_ndk_cpp_std_version :=
+ ifndef LOCAL_USE_VNDK
my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
my_cpu_variant := mips32r6
@@ -248,6 +268,7 @@
endif
endif
endif
+ endif
endif
ifndef LOCAL_IS_HOST_MODULE
@@ -268,7 +289,7 @@
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
endif
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
my_all_ndk_libraries := \
$(NDK_MIGRATED_LIBS) $(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES))
my_ndk_shared_libraries := \
@@ -477,17 +498,30 @@
## Define PRIVATE_ variables from global vars
###########################################################
ifndef LOCAL_IS_HOST_MODULE
-ifdef LOCAL_SDK_VERSION
+ifdef LOCAL_USE_VNDK
+my_target_global_c_includes := \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
+my_target_global_c_system_includes := \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ $(my_ndk_sysroot_include)
+else ifdef LOCAL_SDK_VERSION
my_target_global_c_includes :=
my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
-else
+else ifdef BOARD_VNDK_VERSION
my_target_global_c_includes := $(SRC_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
-endif # LOCAL_SDK_VERSION
+else
+my_target_global_c_includes := $(SRC_HEADERS) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
+my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
+endif
ifeq ($(my_clang),true)
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
@@ -511,10 +545,8 @@
else # LOCAL_IS_HOST_MODULE
my_host_global_c_includes := $(SRC_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
ifeq ($(my_clang),true)
@@ -1327,7 +1359,7 @@
## they may cusomize their install path with LOCAL_MODULE_PATH
##########################################################
# Get the list of INSTALLED libraries as module names.
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
installed_shared_library_module_names := \
$(my_shared_libraries)
else
@@ -1496,7 +1528,7 @@
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
built_shared_libraries := \
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
@@ -1678,7 +1710,7 @@
# One last verification check for ldlibs
ifndef LOCAL_IS_HOST_MODULE
my_allowed_ldlibs :=
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES))
endif
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index faf18e3..b9c28b1 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -216,6 +216,7 @@
LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES:=
LOCAL_LOGTAGS_FILES:=
LOCAL_RECORDED_MODULE_TYPE:=
+LOCAL_USE_VNDK:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
diff --git a/core/config.mk b/core/config.mk
index 6ebd368..7bcaa5c 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -689,10 +689,8 @@
RELATIVE_PWD :=
endif
-HOST_PROJECT_INCLUDES :=
-HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_OUT_HEADERS)
TARGET_PROJECT_INCLUDES :=
-TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_OUT_HEADERS) \
+TARGET_PROJECT_SYSTEM_INCLUDES := \
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
$(TARGET_PRODUCT_KERNEL_HEADERS)
@@ -701,24 +699,9 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
endif
-ifdef HOST_2ND_ARCH
-$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_INCLUDES := $(HOST_PROJECT_INCLUDES)
-$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_PROJECT_SYSTEM_INCLUDES)
-endif
-
-ifdef HOST_CROSS_OS
-HOST_CROSS_PROJECT_INCLUDES :=
-HOST_CROSS_PROJECT_SYSTEM_INCLUDES := $(HOST_CROSS_OUT_HEADERS)
-
-ifdef HOST_CROSS_2ND_ARCH
-$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(HOST_CROSS_PROJECT_INCLUDES)
-$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_SYSTEM_INCLUDES:= $(HOST_CROSS_PROJECT_SYSTEM_INCLUDES)
-endif
-endif
-
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
- TARGET_DEFAULT_JAVA_LIBRARIES := core-oj core-libart core-junit ext framework okhttp
+ TARGET_DEFAULT_JAVA_LIBRARIES := core-oj core-libart legacy-test ext framework okhttp
endif
# Flags for DEX2OAT
diff --git a/core/copy_headers.mk b/core/copy_headers.mk
index 417a76c..c26d51d 100644
--- a/core/copy_headers.mk
+++ b/core/copy_headers.mk
@@ -1,11 +1,30 @@
+ifneq (,$(strip $(LOCAL_COPY_HEADERS)))
###########################################################
## Copy headers to the install tree
###########################################################
$(call record-module-type,COPY_HEADERS)
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
- my_prefix := HOST_
-else
- my_prefix := TARGET_
+ $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_COPY_HEADERS may not be used with host modules >&2)
+ $(error done)
+endif
+
+# Modules linking against the SDK do not have the include path to use
+# COPY_HEADERS, so prevent them from exporting any either.
+ifdef LOCAL_SDK_VERSION
+$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2)
+$(error done)
+endif
+
+include $(BUILD_SYSTEM)/local_vndk.mk
+
+# If we're using the VNDK, only vendor modules using the VNDK may use
+# LOCAL_COPY_HEADERS. Platform libraries will not have the include path
+# present.
+ifdef BOARD_VNDK_VERSION
+ifndef LOCAL_USE_VNDK
+$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2)
+$(error done)
+endif
endif
# Create a rule to copy each header, and make the
@@ -17,8 +36,8 @@
$(eval _chFrom := $(LOCAL_PATH)/$(header)) \
$(eval _chTo := \
$(if $(LOCAL_COPY_HEADERS_TO),\
- $($(my_prefix)OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
- $($(my_prefix)OUT_HEADERS)/$(notdir $(header)))) \
+ $(TARGET_OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
+ $(TARGET_OUT_HEADERS)/$(notdir $(header)))) \
$(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \
$(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \
$(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \
@@ -26,3 +45,5 @@
)
_chFrom :=
_chTo :=
+
+endif # LOCAL_COPY_HEADERS
diff --git a/core/definitions.mk b/core/definitions.mk
index 7a42ad8..698f52c 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -417,7 +417,7 @@
define find-subdir-assets
$(sort $(if $(1),$(patsubst ./%,%, \
$(shell if [ -d $(1) ] ; then cd $(1) ; find -L ./ -not -name '.*' -and -type f ; fi)), \
- $(warning Empty argument supplied to find-subdir-assets) \
+ $(warning Empty argument supplied to find-subdir-assets in $(LOCAL_PATH)) \
))
endef
@@ -1773,7 +1773,6 @@
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
$(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl$(comma)-shared) \
- $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(PRIVATE_TARGET_CRTBEGIN_SO_O) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -1860,7 +1859,6 @@
-Wl,-dynamic-linker,$(PRIVATE_LINKER) \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
- $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O) \
$(PRIVATE_ALL_OBJECTS) \
@@ -1904,7 +1902,6 @@
$(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \
-Wl,--gc-sections \
-o $@ \
- $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(PRIVATE_TARGET_CRTBEGIN_STATIC_O) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 8794c8a..b08f57c 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -269,7 +269,6 @@
HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
-HOST_OUT_HEADERS := $(HOST_OUT_INTERMEDIATES)/include
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
@@ -279,7 +278,6 @@
include $(BUILD_SYSTEM)/aux_config.mk
HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
-HOST_CROSS_OUT_HEADERS := $(HOST_CROSS_OUT_INTERMEDIATES)/include
HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib
HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 593f9f4..f51ddb8 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -34,7 +34,6 @@
endif
# Define PRIVATE_ variables from global vars
-my_target_global_ld_dirs :=
ifeq ($(LOCAL_NO_LIBGCC),true)
my_target_libgcc :=
else
@@ -50,20 +49,11 @@
my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
endif
-ifdef LOCAL_SDK_VERSION
-# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
-# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
-my_target_global_ld_dirs := \
- $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_sysroot_lib)) \
- $(my_target_global_ld_dirs)
-my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_dynamic.o)
my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.o)
my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
endif
-$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
-$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
diff --git a/core/local_vndk.mk b/core/local_vndk.mk
new file mode 100644
index 0000000..f81249b
--- /dev/null
+++ b/core/local_vndk.mk
@@ -0,0 +1,25 @@
+# Verify LOCAL_USE_VNDK usage, and set LOCAL_SDK_VERSION if necessary
+
+ifdef LOCAL_IS_HOST_MODULE
+ ifdef LOCAL_USE_VNDK
+ $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Do not use LOCAL_USE_VNDK with host modules >&2)
+ $(error done)
+ endif
+endif
+ifdef LOCAL_USE_VNDK
+ ifneq ($(LOCAL_USE_VNDK),true)
+ $(shell echo '$(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_USE_VNDK must be "true" or empty, not "$(LOCAL_USE_VNDK)"' >&2)
+ $(error done)
+ endif
+
+ ifdef LOCAL_SDK_VERSION
+ $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_USE_VNDK must not be used with LOCAL_SDK_VERSION >&2)
+ $(error done)
+ endif
+
+ # If we're not using the VNDK, drop all restrictions
+ ifndef BOARD_VNDK_VERSION
+ LOCAL_USE_VNDK:=
+ endif
+endif
+
diff --git a/core/package_internal.mk b/core/package_internal.mk
index af1d2a5..5dd021c 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -140,9 +140,9 @@
$(addprefix $(d)/, \
$(call find-subdir-assets,$(d)))))
-my_res_resources := $(strip \
+my_res_resources := $(if $(my_res_dir),$(strip \
$(addprefix $(my_res_dir)/, \
- $(call find-subdir-assets,$(my_res_dir))))
+ $(call find-subdir-assets,$(my_res_dir)))))
all_resources := $(strip $(my_res_resources) $(my_overlay_resources))
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index c0aaacd..8c986d6 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -17,7 +17,7 @@
target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates \
target/common/obj/JAVA_LIBRARIES/core-oj_intermediates \
target/common/obj/JAVA_LIBRARIES/core-libart_intermediates \
- target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \
+ target/common/obj/JAVA_LIBRARIES/legacy-test_intermediates \
target/common/obj/JAVA_LIBRARIES/ext_intermediates \
target/common/obj/JAVA_LIBRARIES/framework_intermediates \
target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 1a8975a..6b914c9 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -39,7 +39,6 @@
include $(BUILD_SYSTEM)/dynamic_binary.mk
# Define PRIVATE_ variables from global vars
-my_target_global_ld_dirs :=
ifeq ($(LOCAL_NO_LIBGCC),true)
my_target_libgcc :=
else
@@ -53,19 +52,10 @@
my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
endif
-ifdef LOCAL_SDK_VERSION
-# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
-# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
-my_target_global_ld_dirs := \
- $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_sysroot_lib)) \
- $(my_target_global_ld_dirs)
-my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o)
my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
endif
-$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
-$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 995d9ed..1782ce5 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -47,6 +47,7 @@
echo ' "DeviceCpuVariant": "$(TARGET_CPU_VARIANT)",'; \
echo ' "DeviceAbi": ["$(TARGET_CPU_ABI)", "$(TARGET_CPU_ABI2)"],'; \
echo ' "DeviceUsesClang": $(if $(USE_CLANG_PLATFORM_BUILD),$(USE_CLANG_PLATFORM_BUILD),false),'; \
+ echo ' "DeviceVndkVersion": "$(BOARD_VNDK_VERSION)",'; \
echo ''; \
echo ' "DeviceSecondaryArch": "$(TARGET_2ND_ARCH)",'; \
echo ' "DeviceSecondaryArchVariant": "$(TARGET_2ND_ARCH_VARIANT)",'; \
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 04dc015..fe1a382 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -59,7 +59,6 @@
keystore \
keystore.default \
ld.mc \
- libbcc \
libOpenMAXAL \
libOpenSLES \
libdownmix \
@@ -95,7 +94,7 @@
core-libart \
conscrypt \
okhttp \
- core-junit \
+ legacy-test \
bouncycastle \
ext \
framework \
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index ea70454..ef8794d 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -89,7 +89,7 @@
core-libart \
conscrypt \
okhttp \
- core-junit \
+ legacy-test \
bouncycastle \
ext \
framework \
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 5faf24f..78b61a6 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -79,12 +79,12 @@
# SELinux packages
PRODUCT_PACKAGES += \
- sepolicy \
file_contexts.bin \
- seapp_contexts \
- property_contexts \
mac_permissions.xml \
+ property_contexts \
+ seapp_contexts \
selinux_version \
+ sepolicy \
service_contexts
# Ensure that this property is always defined so that bionic_systrace.cpp
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 5fd4d7e..3dd505f 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -16,41 +16,61 @@
# Provides a functioning ART environment without Android frameworks
+# Minimal boot classpath. This should be a subset of PRODUCT_BOOT_JARS, and equivalent to
+# TARGET_CORE_JARS.
PRODUCT_PACKAGES += \
apache-xml \
- ahat \
bouncycastle \
- cacerts \
- conscrypt \
core-oj \
- core-junit \
core-libart \
- dalvikvm \
- dex2oat \
- dexdeps \
- dexdump \
- dexlist \
- dmtracedump \
- dx \
+ conscrypt \
+ okhttp \
+
+# Additional mixins to the boot classpath.
+PRODUCT_PACKAGES += \
+ legacy-test \
+
+# Why are we pulling in ext, which is frameworks/base, depending on tagsoup and nist-sip?
+PRODUCT_PACKAGES += \
ext \
- hprof-conv \
- libart \
- libart_fake \
- libcrypto \
+
+# Why are we pulling in expat, which is used in frameworks, only, it seem?
+PRODUCT_PACKAGES += \
libexpat \
- libicui18n \
- libicuuc \
+
+# Libcore.
+PRODUCT_PACKAGES += \
libjavacore \
libopenjdk \
libopenjdkjvm \
- libnativehelper \
- libssl \
- libz \
- oatdump \
- okhttp \
+
+# Libcore ICU. TODO: Try to figure out if/why we need them explicitly.
+PRODUCT_PACKAGES += \
+ libicui18n \
+ libicuuc \
+
+# ART.
+PRODUCT_PACKAGES += \
+ dalvikvm \
+ dex2oat \
+ libart \
+ libart_fake \
+ libopenjdkjvmti \
patchoat \
profman
+# ART/dex helpers.
+PRODUCT_PACKAGES += \
+ ahat \
+ dexdump \
+ dexlist \
+ hprof-conv \
+ oatdump \
+
+# Certificates.
+PRODUCT_PACKAGES += \
+ cacerts \
+
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
dalvik.vm.image-dex2oat-Xms=64m \
dalvik.vm.image-dex2oat-Xmx=64m \
diff --git a/tools/fs_config/README b/tools/fs_config/README
index 7eca4a3..0258687 100644
--- a/tools/fs_config/README
+++ b/tools/fs_config/README
@@ -67,8 +67,9 @@
* hex (0xFF)
For multiple caps, just separate by whitespace.
-It is an error to specify multiple sections with the same [path]. Per the ini
-specifications enforced by Pythons ConfigParser.
+It is an error to specify multiple sections with the same [path] in different
+files. Note that the same file may contain sections that override the previous
+section in Python versions <= 3.2. In Python 3.2 it's set to strict mode.
The next section type is the "AID" section, for specifying OEM specific AIDS.
@@ -84,13 +85,13 @@
The <name> can be any valid character for a #define identifier in C.
value:
- A valid C style number string. Hex, octal, binary and decimal are supported. See "caps"
- above for more details on number formatting.
+ A valid C style number string. Hex, octal, binary and decimal are supported.
+ See "caps" above for more details on number formatting.
-It is an error to specify multiple sections with the same [AID_<name>]. Per the ini
-specifications enforced by Pythons ConfigParser. It is also an error to specify
-multiple sections with the same value option. It is also an error to specify a value
-that is outside of the inclusive OEM ranges:
+It is an error to specify multiple sections with the same [AID_<name>]. With
+the same constraints as [path] described above. It is also an error to specify
+multiple sections with the same value option. It is also an error to specify a
+value that is outside of the inclusive OEM ranges:
* AID_OEM_RESERVED_START(2900) - AID_OEM_RESERVED_END(2999)
* AID_OEM_RESERVED_2_START(5000) - AID_OEM_RESERVED_2_END(5999)
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index 482c2bc..6a16fea 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -183,8 +183,6 @@
are_aids = len(aids) > 0
if are_aids:
- # sort on value of (file_name, name, value, strvalue)
- aids.sort(key=lambda x: x[2])
for a in aids:
# use the preserved str value
print FILE_COMMENT % a[0]
@@ -272,7 +270,24 @@
for x in sys.argv[1:]:
parse(x, files, dirs, aids, seen_paths, seen_aids)
+ # sort entries:
+ # * specified path before prefix match
+ # ** ie foo before f*
+ # * lexicographical less than before other
+ # ** ie boo before foo
+ # Given these paths:
+ # paths=['ac', 'a', 'acd', 'an', 'a*', 'aa', 'ac*']
+ # The sort order would be:
+ # paths=['a', 'aa', 'ac', 'acd', 'an', 'ac*', 'a*']
+ # Thus the fs_config tools will match on specified paths before attempting
+ # prefix, and match on the longest matching prefix.
files.sort(key= lambda x: file_key(x[1]))
+
+ # sort on value of (file_name, name, value, strvalue)
+ # This is only cosmetic so AIDS are arranged in ascending order
+ # within the generated file.
+ aids.sort(key=lambda x: x[2])
+
generate(files, dirs, aids)
if __name__ == '__main__':
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 3884f49..6852d02 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -383,6 +383,14 @@
if recovery_image:
recovery_image.AddToZip(output_zip)
+ banner("recovery (two-step image)")
+ # The special recovery.img for two-step package use.
+ recovery_two_step_image = common.GetBootableImage(
+ "IMAGES/recovery-two-step.img", "recovery-two-step.img",
+ OPTIONS.input_tmp, "RECOVERY", two_step_image=True)
+ if recovery_two_step_image:
+ recovery_two_step_image.AddToZip(output_zip)
+
banner("system")
system_img_path = AddSystem(
output_zip, recovery_img=recovery_image, boot_img=boot_image)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 813b2c6..8ed12dc 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -395,13 +395,17 @@
def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
- has_ramdisk=False):
+ has_ramdisk=False, two_step_image=False):
"""Build a bootable image from the specified sourcedir.
Take a kernel, cmdline, and optionally a ramdisk directory from the input (in
- 'sourcedir'), and turn them into a boot image. Return the image data, or
- None if sourcedir does not appear to contains files for building the
- requested image."""
+ 'sourcedir'), and turn them into a boot image. 'two_step_image' indicates if
+ we are building a two-step special image (i.e. building a recovery image to
+ be loaded into /boot in two-step OTAs).
+
+ Return the image data, or None if sourcedir does not appear to contains files
+ for building the requested image.
+ """
def make_ramdisk():
ramdisk_img = tempfile.NamedTemporaryFile()
@@ -485,7 +489,12 @@
if (info_dict.get("boot_signer", None) == "true" and
info_dict.get("verity_key", None)):
- path = "/" + os.path.basename(sourcedir).lower()
+ # Hard-code the path as "/boot" for two-step special recovery image (which
+ # will be loaded into /boot during the two-step OTA).
+ if two_step_image:
+ path = "/boot"
+ else:
+ path = "/" + os.path.basename(sourcedir).lower()
cmd = [OPTIONS.boot_signer_path]
cmd.extend(OPTIONS.boot_signer_args)
cmd.extend([path, img.name,
@@ -539,7 +548,7 @@
def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
- info_dict=None, system_img_path=None):
+ info_dict=None, two_step_image=False):
"""Return a File object with the desired bootable image.
Look for it in 'unpack_dir'/BOOTABLE_IMAGES under the name 'prebuilt_name',
@@ -571,7 +580,7 @@
fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
data = _BuildBootableImage(os.path.join(unpack_dir, tree_subdir),
os.path.join(unpack_dir, fs_config),
- info_dict, has_ramdisk)
+ info_dict, has_ramdisk, two_step_image)
if data:
return File(name, data)
return None
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index aa21d7e..84e0e63 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -86,6 +86,8 @@
continue
if not image.endswith(".img"):
continue
+ if image == "recovery-two-step.img":
+ continue
common.ZipWrite(
output_zip, os.path.join(images_path, image), image)
done = True
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 403a3a4..b11e85d 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -461,6 +461,39 @@
script.AssertOemProperty(prop, oem_dict.get(prop))
+def _WriteRecoveryImageToBoot(script, output_zip):
+ """Find and write recovery image to /boot in two-step OTA.
+
+ In two-step OTAs, we write recovery image to /boot as the first step so that
+ we can reboot to there and install a new recovery image to /recovery.
+ A special "recovery-two-step.img" will be preferred, which encodes the correct
+ path of "/boot". Otherwise the device may show "device is corrupt" message
+ when booting into /boot.
+
+ Fall back to using the regular recovery.img if the two-step recovery image
+ doesn't exist. Note that rebuilding the special image at this point may be
+ infeasible, because we don't have the desired boot signer and keys when
+ calling ota_from_target_files.py.
+ """
+
+ recovery_two_step_img_name = "recovery-two-step.img"
+ recovery_two_step_img_path = os.path.join(
+ OPTIONS.input_tmp, "IMAGES", recovery_two_step_img_name)
+ if os.path.exists(recovery_two_step_img_path):
+ recovery_two_step_img = common.GetBootableImage(
+ recovery_two_step_img_name, recovery_two_step_img_name,
+ OPTIONS.input_tmp, "RECOVERY")
+ common.ZipWriteStr(
+ output_zip, recovery_two_step_img_name, recovery_two_step_img.data)
+ print "two-step package: using %s in stage 1/3" % (
+ recovery_two_step_img_name,)
+ script.WriteRawImage("/boot", recovery_two_step_img_name)
+ else:
+ print "two-step package: using recovery.img in stage 1/3"
+ # The "recovery.img" entry has been written into package earlier.
+ script.WriteRawImage("/boot", "recovery.img")
+
+
def HasRecoveryPatch(target_files_zip):
namelist = [name for name in target_files_zip.namelist()]
return ("SYSTEM/recovery-from-boot.p" in namelist or
@@ -609,6 +642,9 @@
script.AppendExtra("""
if get_stage("%(bcb_dev)s") == "2/3" then
""" % bcb_dev)
+
+ # Stage 2/3: Write recovery image to /recovery (currently running /boot).
+ script.Comment("Stage 2/3")
script.WriteRawImage("/recovery", "recovery.img")
script.AppendExtra("""
set_stage("%(bcb_dev)s", "3/3");
@@ -616,6 +652,9 @@
else if get_stage("%(bcb_dev)s") == "3/3" then
""" % bcb_dev)
+ # Stage 3/3: Make changes.
+ script.Comment("Stage 3/3")
+
# Dump fingerprints
script.Print("Target: %s" % target_fp)
@@ -714,7 +753,11 @@
set_stage("%(bcb_dev)s", "");
""" % bcb_dev)
script.AppendExtra("else\n")
- script.WriteRawImage("/boot", "recovery.img")
+
+ # Stage 1/3: Nothing to verify for full OTA. Write recovery image to /boot.
+ script.Comment("Stage 1/3")
+ _WriteRecoveryImageToBoot(script, output_zip)
+
script.AppendExtra("""
set_stage("%(bcb_dev)s", "2/3");
reboot_now("%(bcb_dev)s", "");
@@ -938,6 +981,9 @@
script.AppendExtra("""
if get_stage("%(bcb_dev)s") == "2/3" then
""" % bcb_dev)
+
+ # Stage 2/3: Write recovery image to /recovery (currently running /boot).
+ script.Comment("Stage 2/3")
script.AppendExtra("sleep(20);\n")
script.WriteRawImage("/recovery", "recovery.img")
script.AppendExtra("""
@@ -946,6 +992,9 @@
else if get_stage("%(bcb_dev)s") != "3/3" then
""" % bcb_dev)
+ # Stage 1/3: (a) Verify the current system.
+ script.Comment("Stage 1/3")
+
# Dump fingerprints
script.Print(source_fp)
script.Print(target_fp)
@@ -1016,13 +1065,18 @@
device_specific.IncrementalOTA_VerifyEnd()
if OPTIONS.two_step:
- script.WriteRawImage("/boot", "recovery.img")
+ # Stage 1/3: (b) Write recovery image to /boot.
+ _WriteRecoveryImageToBoot(script, output_zip)
+
script.AppendExtra("""
set_stage("%(bcb_dev)s", "2/3");
reboot_now("%(bcb_dev)s", "");
else
""" % bcb_dev)
+ # Stage 3/3: Make changes.
+ script.Comment("Stage 3/3")
+
# Verify the existing partitions.
system_diff.WriteVerifyScript(script, touched_blocks_only=True)
if vendor_diff:
@@ -1615,6 +1669,9 @@
script.AppendExtra("""
if get_stage("%(bcb_dev)s") == "2/3" then
""" % bcb_dev)
+
+ # Stage 2/3: Write recovery image to /recovery (currently running /boot).
+ script.Comment("Stage 2/3")
script.AppendExtra("sleep(20);\n")
script.WriteRawImage("/recovery", "recovery.img")
script.AppendExtra("""
@@ -1623,6 +1680,9 @@
else if get_stage("%(bcb_dev)s") != "3/3" then
""" % bcb_dev)
+ # Stage 1/3: (a) Verify the current system.
+ script.Comment("Stage 1/3")
+
# Dump fingerprints
script.Print("Source: %s" % (source_fp,))
script.Print("Target: %s" % (target_fp,))
@@ -1667,13 +1727,18 @@
device_specific.IncrementalOTA_VerifyEnd()
if OPTIONS.two_step:
- script.WriteRawImage("/boot", "recovery.img")
+ # Stage 1/3: (b) Write recovery image to /boot.
+ _WriteRecoveryImageToBoot(script, output_zip)
+
script.AppendExtra("""
set_stage("%(bcb_dev)s", "2/3");
reboot_now("%(bcb_dev)s", "");
else
""" % bcb_dev)
+ # Stage 3/3: Make changes.
+ script.Comment("Stage 3/3")
+
script.Comment("---- start making changes here ----")
device_specific.IncrementalOTA_InstallBegin()
diff --git a/tools/warn.py b/tools/warn.py
index 5c49cd3..5be6d9d 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -454,7 +454,7 @@
'description': '_ used as an identifier',
'patterns': [r".*: warning: '_' used as an identifier"]},
- # Warnings from Error Prone.
+ # Warnings from Javac
{'category': 'java',
'severity': Severity.MEDIUM,
'description': 'Java: Use of deprecated member',
@@ -464,7 +464,27 @@
'description': 'Java: Unchecked conversion',
'patterns': [r'.*: warning: \[unchecked\] .+']},
- # Warnings from Error Prone (auto generated list).
+ # Begin warnings generated by Error Prone
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
+ 'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
+ 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
+ 'patterns': [r".*: warning: \[UseBinds\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Field name is CONSTANT CASE, but field is not static and final',
+ 'patterns': [r".*: warning: \[ConstantField\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
@@ -473,18 +493,118 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Fallthrough warning suppression has no effect if warning is suppressed',
- 'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.',
- 'patterns': [r".*: warning: \[UseBinds\] .+"]},
+ 'Java: C-style array declarations should not be used',
+ 'patterns': [r".*: warning: \[MixedArrayDimensions\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Variable declarations should declare only one variable',
+ 'patterns': [r".*: warning: \[MultiVariableDeclaration\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Source files should not contain multiple top-level class declarations',
+ 'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Package names should match the directory they are declared in',
+ 'patterns': [r".*: warning: \[PackageLocation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
+ 'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Unused imports',
+ 'patterns': [r".*: warning: \[RemoveUnusedImports\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Unchecked exceptions do not need to be declared in the method signature.',
+ 'patterns': [r".*: warning: \[ThrowsUncheckedException\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Using static imports for types is unnecessary',
+ 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Wildcard imports, static or otherwise, should not be used',
+ 'patterns': [r".*: warning: \[WildcardImport\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
+ 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Hardcoded reference to /sdcard',
+ 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
+ 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
+ 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.',
+ 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: This code declares a binding for a common value type without a Qualifier annotation.',
+ 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: 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.',
+ 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Double-checked locking on non-volatile fields is unsafe',
+ 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Enums should always be immutable',
+ 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Writes to static fields should not be guarded by instance locks',
+ 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
+ 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Method reference is ambiguous',
+ 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: A different potential argument is more similar to the name of the parameter than the existing argument; this may be an error',
+ 'patterns': [r".*: warning: \[ArgumentParameterMismatch\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -498,16 +618,41 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Possible sign flip from narrowing conversion',
+ 'patterns': [r".*: warning: \[BadComparable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)',
'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: valueOf or autoboxing provides better time and space performance',
+ 'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Mockito cannot mock final classes',
'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Inner class is non-static but does not reference enclosing class',
+ 'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Class.newInstance() bypasses exception checking; prefer getConstructor().newInstance()',
+ 'patterns': [r".*: warning: \[ClassNewInstance\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Implicit use of the platform default charset, which can result in e.g. non-ASCII characters being silently replaced with \'?\' in many environments',
+ 'patterns': [r".*: warning: \[DefaultCharset\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This code, which counts elements using a loop, can be replaced by a simpler library method',
'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]},
{'category': 'java',
@@ -533,11 +678,26 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Overloads will be ambiguous when passing lambda arguments',
+ 'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Calling getClass() on an enum may return a subclass of the enum type',
+ 'patterns': [r".*: warning: \[GetClassOnEnum\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
+ 'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Class should not implement both `Iterable` and `Iterator`',
'patterns': [r".*: warning: \[IterableAndIterator\] .+"]},
{'category': 'java',
@@ -553,7 +713,7 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Enum switch statement is missing cases',
+ 'Java: The Google Java Style Guide requires switch statements to have an explicit default',
'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
@@ -568,8 +728,8 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Source files should not contain multiple top-level class declarations',
- 'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
+ 'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
+ 'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -603,13 +763,8 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Package names should match the directory they are declared in',
- 'patterns': [r".*: warning: \[PackageLocation\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped',
- 'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]},
+ 'Java: Use grouping parenthesis to make the operator precedence explicit',
+ 'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -628,6 +783,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Thrown exception is a subtype of another',
+ 'patterns': [r".*: warning: \[RedundantThrows\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Comparison using reference equality instead of value equality',
+ 'patterns': [r".*: warning: \[ReferenceEquality\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
'patterns': [r".*: warning: \[RequiredModifiers\] .+"]},
{'category': 'java',
@@ -643,13 +808,18 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: 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.',
- 'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
+ 'Java: Truth Library assert is called on a constant.',
+ 'patterns': [r".*: warning: \[TruthConstantAsserts\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Using static imports for types is unnecessary',
- 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
+ 'Java: An object is tested for equality to itself using Truth Libraries.',
+ 'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: 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.',
+ 'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -666,50 +836,180 @@
'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
- 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
+ 'Java: Log tag too long, cannot exceed 23 characters.',
+ 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: Hardcoded reference to /sdcard',
- 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
+ 'Java: Certain resources in `android.R.string` have names that do not match their content',
+ 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Return value of android.graphics.Rect.intersect() must be checked',
+ 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Static and default methods in interfaces are not allowed in android builds.',
+ 'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
'description':
'Java: Incompatible type as argument to Object-accepting Java collections method',
'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
- 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
+ 'Java: @CompatibleWith\'s value is not a type argument.',
+ 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.',
+ 'Java: Passing argument to a generic method with an incompatible type.',
+ 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Invalid printf-style format string',
+ 'patterns': [r".*: warning: \[FormatString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Invalid format string passed to formatting method.',
+ 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
+ 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: @AutoFactory and @Inject should not be used in the same type.',
+ 'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Injected constructors cannot be optional nor have binding annotations',
+ 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A scoping annotation\'s Target should include TYPE and METHOD.',
+ 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Abstract and default methods are not injectable with javax.inject.Inject',
+ 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: @javax.inject.Inject cannot be put on a final field.',
+ 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
+ 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Using more than one qualifier annotation on the same element is not allowed.',
+ 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A class can be annotated with at most one scope annotation.',
+ 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
+ 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Qualifier applied to a method that isn\'t a @Provides method. This method won\'t be used for dependency injection',
+ 'patterns': [r".*: warning: \[QualifierOnMethodWithoutProvides\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scope annotation on an interface or abstact class is not allowed',
+ 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scoping and qualifier annotations must have runtime retention.',
+ 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: `@Multibinds` is the new way to declare multibindings.',
+ 'patterns': [r".*: warning: \[MultibindsInsteadOfMultibindings\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
+ 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
+ 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
+ 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: 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.',
- 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
+ 'Java: 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.',
+ 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: Double-checked locking on non-volatile fields is unsafe',
- 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
+ 'Java: @Provides methods need to be declared in a Module to have any effect.',
+ 'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: Writes to static fields should not be guarded by instance locks',
- 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
+ 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
+ 'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
{'category': 'java',
- 'severity': Severity.MEDIUM,
+ 'severity': Severity.HIGH,
'description':
- 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
- 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
+ 'Java: Invalid @GuardedBy expression',
+ 'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Type declaration annotated with @Immutable is not immutable',
+ 'patterns': [r".*: warning: \[Immutable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
+ 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
+ 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: An argument is more similar to a different parameter; the arguments may have been swapped.',
+ 'patterns': [r".*: warning: \[ArgumentParameterSwap\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@@ -724,7 +1024,7 @@
'severity': Severity.HIGH,
'description':
'Java: Calling toString on an array does not provide useful information',
- 'patterns': [r".*: warning: \[ArrayToString.*\] .+"]},
+ 'patterns': [r".*: warning: \[ArrayToString\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@@ -743,21 +1043,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Possible sign flip from narrowing conversion',
- 'patterns': [r".*: warning: \[BadComparable\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
'Java: Shift by an amount that is out of range',
'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: valueOf provides better time and space performance',
- 'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
'Java: 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.',
'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
{'category': 'java',
@@ -768,11 +1058,6 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Inner class is non-static but does not reference enclosing class',
- 'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
'Java: The source file name should match the name of the top-level class it contains',
'patterns': [r".*: warning: \[ClassName\] .+"]},
{'category': 'java',
@@ -793,6 +1078,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Compile-time constant expression overflows',
+ 'patterns': [r".*: warning: \[ConstantOverflow\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Exception created but not thrown',
'patterns': [r".*: warning: \[DeadException\] .+"]},
{'category': 'java',
@@ -818,11 +1108,21 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: 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.',
+ 'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Futures.getChecked requires a checked exception type with a standard constructor.',
'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Calling getClass() on an annotation may return a proxy class',
+ 'patterns': [r".*: warning: \[GetClassOnAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: 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',
'patterns': [r".*: warning: \[GetClassOnClass\] .+"]},
{'category': 'java',
@@ -838,8 +1138,23 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode',
- 'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]},
+ 'Java: Writing "a && a", "a || a", "a & a", or "a | a" is equivalent to "a".',
+ 'patterns': [r".*: warning: \[IdentityBinaryExpression\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
+ 'patterns': [r".*: warning: \[ImmutableModification\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: This method always recurses, and will cause a StackOverflowError',
+ 'patterns': [r".*: warning: \[InfiniteRecursion\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
+ 'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@@ -878,11 +1193,6 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Printf-like format string does not match its arguments',
- 'patterns': [r".*: warning: \[MalformedFormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]},
{'category': 'java',
@@ -898,16 +1208,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Modifying a collection with itself',
+ 'Java: Using a collection function with itself as the argument.',
'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
- 'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation',
'patterns': [r".*: warning: \[NoAllocation\] .+"]},
{'category': 'java',
@@ -918,7 +1223,7 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: @CompileTimeConstant parameters should be final',
+ 'Java: @CompileTimeConstant parameters should be final or effectively final',
'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -943,6 +1248,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Declaring types inside package-info.java files is very bad form',
+ 'patterns': [r".*: warning: \[PackageInfo\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
{'category': 'java',
@@ -963,6 +1273,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Use Random.nextInt(int). Random.nextInt() % n can have negative results',
+ 'patterns': [r".*: warning: \[RandomModInteger\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Check for non-whitelisted callers to RestrictedApiChecker.',
'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
{'category': 'java',
@@ -979,7 +1294,7 @@
'severity': Severity.HIGH,
'description':
'Java: An object is compared to itself',
- 'patterns': [r".*: warning: \[SelfComparision\] .+"]},
+ 'patterns': [r".*: warning: \[SelfComparison\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@@ -1038,128 +1353,15 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Use of wildcard imports is forbidden',
- 'patterns': [r".*: warning: \[WildcardImport\] .+"]},
+ 'Java: Collection is modified in place, but the result is not used',
+ 'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
'Java: Method parameter has wrong package',
'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Certain resources in `android.R.string` have names that do not match their content',
- 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Return value of android.graphics.Rect.intersect() must be checked',
- 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid printf-style format string',
- 'patterns': [r".*: warning: \[FormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
- 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Injected constructors cannot be optional nor have binding annotations',
- 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.',
- 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Abstract methods are not injectable with javax.inject.Inject.',
- 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: @javax.inject.Inject cannot be put on a final field.',
- 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: A class may not have more than one injectable constructor.',
- 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Using more than one qualifier annotation on the same element is not allowed.',
- 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: A class can be annotated with at most one scope annotation',
- 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes',
- 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Scope annotation on an interface or abstact class is not allowed',
- 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Scoping and qualifier annotations must have runtime retention.',
- 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
- 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
- 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ',
- 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject.',
- 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
- 'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid @GuardedBy expression',
- 'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Type declaration annotated with @Immutable is not immutable',
- 'patterns': [r".*: warning: \[Immutable\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
- 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
- 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+
+ # End warnings generated by Error Prone
{'category': 'java',
'severity': Severity.UNKNOWN,