From 0c2143e1ee4d0c1a8f77f953fbc3092f31d8320b Mon Sep 17 00:00:00 2001 From: Pete Gillin Date: Thu, 2 May 2019 15:32:11 +0100 Subject: [PATCH] Rename EXPERIMENTAL_USE_OPENJDK9 to EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9. The current EXPERIMENTAL_USE_OPENJDK9 environment variable is a legacy from when the 8 -> 9 toolchain upgrade was happening. That migration is done and the variable only affects the language level, so it should have a name that reflects that. (The current situation would be especially confusing if we started a 9 -> 11 toolchain upgrade, presumably controlled by a variable like EXPERIMENTAL_USE_OPENJDK11, since the two settings look incompatible but are actually orthogonal.) The current variable historically allowed a value or "1.8" which meant "use the OpenJDK 9 toolchain but target language level 8". That value no longer has any meaning and the new variable doesn't allow it. Bug: 131678633 Test: `make` with `EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true` Test: `javap -v $OUT_DIR/soong/.intermediates/libcore/core-oj/android_common/javac/classes/java/util/List.class | grep 'major version'` shows 53 Test: Audit all mentions of the old string here and downstream Change-Id: Idad808c7f07913baba1a777627322d5452dabcef --- android/config.go | 10 +++++----- java/java_test.go | 10 +++++----- java/sdk_test.go | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/android/config.go b/android/config.go index 3495ad28a..5973b11e9 100644 --- a/android/config.go +++ b/android/config.go @@ -349,14 +349,14 @@ func NewConfig(srcDir, buildDir string) (Config, error) { } func (c *config) fromEnv() error { - switch c.Getenv("EXPERIMENTAL_USE_OPENJDK9") { - case "", "1.8": - // Nothing, we always use OpenJDK9 + switch c.Getenv("EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9") { + case "": + // Nothing, this is the default case "true": - // Use OpenJDK9 and target 1.9 + // Use -source 9 -target 9 c.targetOpenJDK9 = true default: - return fmt.Errorf(`Invalid value for EXPERIMENTAL_USE_OPENJDK9, should be "", "1.8", or "true"`) + return fmt.Errorf(`Invalid value for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9, should be "" or "true"`) } return nil diff --git a/java/java_test.go b/java/java_test.go index 3fab43d6d..e4a7fbed2 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -945,8 +945,8 @@ func TestPatchModule(t *testing.T) { } ` - t.Run("1.8", func(t *testing.T) { - // Test default javac 1.8 + t.Run("Java language level 8", func(t *testing.T) { + // Test default javac -source 1.8 -target 1.8 ctx := testJava(t, bp) checkPatchModuleFlag(t, ctx, "foo", "") @@ -954,9 +954,9 @@ func TestPatchModule(t *testing.T) { checkPatchModuleFlag(t, ctx, "baz", "") }) - t.Run("1.9", func(t *testing.T) { - // Test again with javac 1.9 - config := testConfig(map[string]string{"EXPERIMENTAL_USE_OPENJDK9": "true"}) + t.Run("Java language level 9", func(t *testing.T) { + // Test again with javac -source 9 -target 9 + config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "true"}) ctx := testContext(config, bp, nil) run(t, ctx, config) diff --git a/java/sdk_test.go b/java/sdk_test.go index e446129a5..cc4da2eca 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -272,8 +272,8 @@ func TestClasspath(t *testing.T) { } } - t.Run("1.8", func(t *testing.T) { - // Test default javac 1.8 + t.Run("Java language level 8", func(t *testing.T) { + // Test default javac -source 1.8 -target 1.8 config := testConfig(nil) if testcase.unbundled { config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true) @@ -299,9 +299,9 @@ func TestClasspath(t *testing.T) { } }) - // Test again with javac 1.9 - t.Run("1.9", func(t *testing.T) { - config := testConfig(map[string]string{"EXPERIMENTAL_USE_OPENJDK9": "true"}) + // Test again with javac -source 9 -target 9 + t.Run("Java language level 9", func(t *testing.T) { + config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "true"}) if testcase.unbundled { config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true) }