From bf4ac7a82fd0747dfefcbbd517d3d0c52e0a34be Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 20 Jul 2017 15:05:10 -0700 Subject: [PATCH] Disable desugaring try-with-resources Desugaring try-with-resources is not necessary for platform builds, and triggers some problems for apps built as part of the platform that target SDK versions before 19. Disable all try-with-resource desugaring. Bug: 63180735 Bug: 63900665 Bug: 63901645 Test: m -j ANDROID_COMPILE_WITH_JACK=false checkbuild Change-Id: I98b827aa1e80b43e6eb7b58254c23c7a4f7dc52d --- core/definitions.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/definitions.mk b/core/definitions.mk index 6199837ad..775627bec 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2527,6 +2527,7 @@ $(if $(filter $(1),$(PLATFORM_VERSION_CODENAME)),10000,$(1)) endef # --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup +# --desugar_try_with_resources_if_needed=false is needed due to b/63180735, b/63901645, b/63900665 define desugar-classes-jar @echo Desugar: $@ @mkdir -p $(dir $@) @@ -2540,6 +2541,7 @@ $(hide) $(JAVA) \ $(addprefix --bootclasspath_entry ,$(call desugar-bootclasspath,$(PRIVATE_BOOTCLASSPATH))) \ $(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_LIBRARIES)) \ --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ + --desugar_try_with_resources_if_needed=false \ --allow_empty_bootclasspath \ $(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \ -i $< -o $@.tmp