From eed17d84ccfe9cf49af913ba44222ea3907b753a Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Fri, 19 Feb 2016 10:37:22 +0000 Subject: [PATCH] Add core-lambda-stubs to default classpath for target libs compiling using javac In order to compile lambda code javac requires various invokedynamic- related classes to be present. This change adds stubs needed for javac to compile lambdas. Bug: 27475234 Bug: 26753820 Bug: 26604040 (cherry picked from commit b08544ed7d24b7b065debc061290ec55eaeced20) Change-Id: Ie82600da21a9dbe2348e96aef1c5e966a7a1ef5a --- core/java_common.mk | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/java_common.mk b/core/java_common.mk index f9839352f6..5720b88b5e 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -182,8 +182,20 @@ endif # current or system_current endif # LOCAL_SDK_VERSION $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath) -full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) -full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +# In order to compile lambda code javac requires various invokedynamic- +# related classes to be present. This change adds stubs needed for +# javac to compile lambdas. +my_additional_javac_libs := +ifndef TARGET_BUILD_APPS +# TODO: support to build lamdbas using javac in unbundled build. +# We may need to check in a prebuilt core-lambda-stubs to prebuilts/sdk. +ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) +my_additional_javac_libs := core-lambda-stubs +endif +endif + +full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE)) +full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE)) full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps)) else # LOCAL_IS_HOST_MODULE