Desugar default methods if required
Desugar default methods if requested by LOCAL_MIN_SDK_VERSION < 26.
Also remove --desugar_try_with_resources_if_needed=false, it is no
longer necessary if we always proguard against frameworks.jar.
Fixes d8 issues when it sees unexpected default methods that dx
was passing through.
This reapplies I81796b452d5a70a951e175727953d4295ca32c0c after
If30943efcaea44b2db1b38a6c1d558113324757f.
Test: m checkbuild
Change-Id: I3bafbb2d63de2a6b50bc8c7ff40259b54d24f128
diff --git a/core/definitions.mk b/core/definitions.mk
index e5dbdbc..b988d1e 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2385,7 +2385,6 @@
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 $@)
@@ -2398,8 +2397,7 @@
-jar $(DESUGAR) \
$(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
$(addprefix --classpath_entry ,$(PRIVATE_SHARED_JAVA_HEADER_LIBRARIES)) \
- --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
- --desugar_try_with_resources_if_needed=false \
+ --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
--allow_empty_bootclasspath \
$(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
-i $< -o $@.tmp