Remove support for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.

Prior to this change, setting that to "false" turned the default Java
language level back to 8. This change removes that option.

Bug: 115604102
Test: m java droid docs tests cts
Change-Id: I97bfd0dc8d941008b4071c6efe1c0c24950c4f1f
This commit is contained in:
Pete Gillin
2019-10-17 14:52:07 +01:00
parent e195591829
commit a1c9e9da55
4 changed files with 5 additions and 26 deletions

View File

@@ -113,8 +113,6 @@ type config struct {
captureBuild bool // true for tests, saves build parameters for each module
ignoreEnvironment bool // true for tests, returns empty from all Getenv calls
targetOpenJDK9 bool // Target 1.9
stopBefore bootstrap.StopBefore
OncePer
@@ -392,13 +390,9 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
func (c *config) fromEnv() error {
switch c.Getenv("EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9") {
case "", "true":
// Use -source 9 -target 9. This is the default.
c.targetOpenJDK9 = true
case "false":
// Use -source 8 -target 8. This is the legacy behaviour.
c.targetOpenJDK9 = false
// Do nothing
default:
return fmt.Errorf(`Invalid value for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9, should be "", "true", or "false"`)
return fmt.Errorf("The environment variable EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9 is no longer supported. Java language level 9 is now the global default.")
}
return nil
@@ -779,11 +773,6 @@ func (c *config) EmitXrefRules() bool {
return c.XrefCorpusName() != ""
}
// Returns true if -source 1.9 -target 1.9 is being passed to javac
func (c *config) TargetOpenJDK9() bool {
return c.targetOpenJDK9
}
func (c *config) ClangTidy() bool {
return Bool(c.productVariables.ClangTidy)
}

View File

@@ -29,12 +29,6 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES", strings.Join(DefaultBootclasspathLibraries, " "))
ctx.Strict("DEFAULT_SYSTEM_MODULES", DefaultSystemModules)
if ctx.Config().TargetOpenJDK9() {
ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "1.9")
} else {
ctx.Strict("DEFAULT_JAVA_LANGUAGE_VERSION", "1.8")
}
ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}")
ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}")
ctx.Strict("ANDROID_JAVA9_HOME", "prebuilts/jdk/jdk9/${hostPrebuiltTag}")

View File

@@ -425,16 +425,12 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
if sdkDep.hasStandardLibs() {
if sdkDep.useDefaultLibs {
ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...)
if ctx.Config().TargetOpenJDK9() {
ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules)
}
ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules)
if sdkDep.hasFrameworkLibs() {
ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...)
}
} else if sdkDep.useModule {
if ctx.Config().TargetOpenJDK9() {
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
}
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.modules...)
}
} else if sdkDep.systemModules != "" {

View File

@@ -884,7 +884,7 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd
ret = normalizeJavaVersion(ctx, javaVersion)
} else if ctx.Device() && sdk <= 23 {
ret = "1.7"
} else if ctx.Device() && sdk <= 29 || !ctx.Config().TargetOpenJDK9() {
} else if ctx.Device() && sdk <= 29 {
ret = "1.8"
} else if ctx.Device() &&
sdkContext.sdkVersion() != "" &&