diff options
author | 2019-10-01 13:57:31 +0100 | |
---|---|---|
committer | 2019-10-16 11:20:13 +0100 | |
commit | 1b3370f5d75e00b074fd7965c5e1d996636879db (patch) | |
tree | cbca9150b5d1536c07e39fbfa17eb1379be885af /java | |
parent | 300a084db6eece05cc9ccf52d6006797507e2dde (diff) |
Enable Java language level 9 by default.
This changes the default Java language level from 8 to 9, i.e. javac
invocations now use -source 1.9 -target 1.9.
The environment variable EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false is
added to switch back to the language level 8 behaviour. (Previously,
setting that variable to true was required to opt in to language level
9.)
Test: make droid java tests cts docs
Test: javap -v <some class file in output> | grep 'major version' (reports 53, for classes from 'benchmarks' which is in Android.bp and 'ahat' which is in Android.mk)
Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests (two main flavours of robolectric)
Test: make cts && cts-tradefed help
Test: atest CtsLibcoreTestCases (reasonably low-level device tests)
Test: atest CtsHostTzDataTests (arbitrary host test)
Bug: 115604102
Change-Id: I9de888e1df021244d5e61c40934178676f09ecc7
Merged-In: I52be1817fa7121fca3bce3d8857cb9ed0825570c
Diffstat (limited to 'java')
-rw-r--r-- | java/java_test.go | 12 | ||||
-rw-r--r-- | java/sdk_test.go | 11 |
2 files changed, 12 insertions, 11 deletions
diff --git a/java/java_test.go b/java/java_test.go index f0cb6f8bd..a3499ccd8 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1095,8 +1095,10 @@ func TestPatchModule(t *testing.T) { ` t.Run("Java language level 8", func(t *testing.T) { - // Test default javac -source 1.8 -target 1.8 - ctx, _ := testJava(t, bp) + // Test with legacy javac -source 1.8 -target 1.8 + config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "false"}) + ctx := testContext(bp, nil) + run(t, ctx, config) checkPatchModuleFlag(t, ctx, "foo", "") checkPatchModuleFlag(t, ctx, "bar", "") @@ -1104,10 +1106,8 @@ func TestPatchModule(t *testing.T) { }) 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(bp, nil) - run(t, ctx, config) + // Test with default javac -source 9 -target 9 + ctx, _ := testJava(t, bp) checkPatchModuleFlag(t, ctx, "foo", "") expected := "java.base=.:" + buildDir diff --git a/java/sdk_test.go b/java/sdk_test.go index 5001b477b..5e0e592f6 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -279,9 +279,9 @@ func TestClasspath(t *testing.T) { } } + // Test with legacy javac -source 1.8 -target 1.8 t.Run("Java language level 8", func(t *testing.T) { - // Test default javac -source 1.8 -target 1.8 - config := testConfig(nil) + config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "false"}) if testcase.unbundled { config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true) } @@ -302,9 +302,9 @@ func TestClasspath(t *testing.T) { } }) - // Test again with javac -source 9 -target 9 + // Test with default 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"}) + config := testConfig(nil) if testcase.unbundled { config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true) } @@ -327,7 +327,8 @@ func TestClasspath(t *testing.T) { // Test again with PLATFORM_VERSION_CODENAME=REL t.Run("REL", func(t *testing.T) { - config := testConfig(nil) + // TODO(b/115604102): This test should be rewritten with language level 9 + config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "false"}) config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("REL") config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(true) |