Add core-lambda-stubs to classpath
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number.
Fixes compiling modules with lambdas against the SDK.
Bug: 80428539
Test: java_test.go
Change-Id: I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6
diff --git a/java/java.go b/java/java.go
index 02fdc00..7abd299 100644
--- a/java/java.go
+++ b/java/java.go
@@ -479,6 +479,7 @@
sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version))
if sdkDep.useDefaultLibs {
ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultBootclasspathLibraries...)
+ ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultLambdaStubsLibraries...)
if ctx.Config().TargetOpenJDK9() {
ctx.AddDependency(ctx.Module(), systemModulesTag, config.DefaultSystemModules)
}
@@ -490,10 +491,13 @@
ctx.AddDependency(ctx.Module(), systemModulesTag, sdkDep.systemModules)
}
ctx.AddDependency(ctx.Module(), bootClasspathTag, sdkDep.module)
+ ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultLambdaStubsLibraries...)
if Bool(j.deviceProperties.Optimize.Enabled) {
ctx.AddDependency(ctx.Module(), proguardRaiseTag, config.DefaultBootclasspathLibraries...)
ctx.AddDependency(ctx.Module(), proguardRaiseTag, config.DefaultLibraries...)
}
+ } else if sdkDep.useFiles {
+ ctx.AddDependency(ctx.Module(), libTag, config.DefaultLambdaStubsLibraries...)
}
} else if j.deviceProperties.System_modules == nil {
ctx.PropertyErrorf("no_standard_libs",
@@ -625,8 +629,9 @@
func getLinkType(m *Module, name string) linkType {
ver := String(m.deviceProperties.Sdk_version)
+ noStdLibs := Bool(m.properties.No_standard_libs)
switch {
- case name == "core.current.stubs" || ver == "core_current":
+ case name == "core.current.stubs" || ver == "core_current" || noStdLibs:
return javaCore
case name == "android_system_stubs_current" || strings.HasPrefix(ver, "system_"):
return javaSystem