From 0ed47f7fd1e67876eb6280f21afcd2d6cfd77412 Mon Sep 17 00:00:00 2001 From: Tobias Thierer Date: Wed, 17 May 2017 17:37:42 +0100 Subject: [PATCH] Fix fragile assumptions about build toolchain. (attempt #2) This CL resubmits a fixed version of commit e2a8da26833be50489a82fed87d0896bd3496709. This CL applies the following changes: - explicitly set the path where desugar will dump temporary class files. This ensures that the system property is set before it is read during InnerClassLambdaMetafactory.. Before this CL, the system property was set by Desugar.createAndRegisterLambdaDumpDirectory(), which may run too late. - explicitly specify -source 1.8 for droiddoc's javadoc run. Previously, the command used the language version of the build toolchain, which might fail due the backward-incompatible restrictions imposed by the proposed module system. Some Android build targets use LOCAL_JAVA_LANGUAGE_VERSION 1.7, but droiddoc combines sources from multiple build targets and there where no backwards incompatible changes in 1.8, so it should be fine to use 1.8 for code from either language level. Bug: 38318052 Bug: 38225656 Bug: 38177295 Test: make clean && make ANDROID_COMPILE_WITH_JACK=false checkbuild tests \ && make checkbuild tests (using OpenJDK 8 toolchain) Change-Id: I2fffe6668747f48be44e34c67332af9b8a996d2a --- core/definitions.mk | 6 +++++- core/droiddoc.mk | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/definitions.mk b/core/definitions.mk index 804f2c37c..4babd60b9 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2535,7 +2535,11 @@ define desugar-classes-jar @echo Desugar: $@ @mkdir -p $(dir $@) $(hide) rm -f $@ $@.tmp -$(hide) java -jar $(DESUGAR) \ +@rm -rf $(dir $@)/desugar_dumped_classes +@mkdir $(dir $@)/desugar_dumped_classes +$(hide) java \ + -Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \ + -jar $(DESUGAR) \ $(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)) \ diff --git a/core/droiddoc.mk b/core/droiddoc.mk index a70ab0341..93d555169 100644 --- a/core/droiddoc.mk +++ b/core/droiddoc.mk @@ -175,6 +175,7 @@ $(full_target): \ $(hide) ( \ javadoc \ -encoding UTF-8 \ + -source 1.8 \ \@$(PRIVATE_SRC_LIST_FILE) \ -J-Xmx1600m \ -XDignore.symbol.file \