diff options
author | Cole Faust <colefaust@google.com> | 2022-06-28 14:41:27 -0700 |
---|---|---|
committer | Steve Elliott <steell@google.com> | 2022-10-28 10:07:42 -0400 |
commit | 3dcaf7550f44ae83c3b5f2da31d7d4b9e5a86b10 (patch) | |
tree | ec90dd42675f29a955f668cee3b0b9a8d94ad7e4 /java/java.go | |
parent | 7c255f8aa2bb6419cc4f1a4d5e0c4006faa4d041 (diff) |
Use the current java version for -jvm-target
This is a partial revert of aosp/541879.
In that cl, the kotlin jvm version was always
set to 1.8 because that's what the kotlin
complier supported at the time, but now
it supports more versions:
$ ./external/kotlinc/bin/kotlinc -jvm-target foo
error: unknown JVM target version: foo
Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17
Bug: 69160377
Bug: 236431222
Test: Treehugger
Change-Id: I273e0b4d1f484013889e17c60bc1b299a3f975a1
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go index 1e99aa32f..9830d08dd 100644 --- a/java/java.go +++ b/java/java.go @@ -526,6 +526,20 @@ func (v javaVersion) String() string { } } +func (v javaVersion) StringForKotlinc() string { + // $ ./external/kotlinc/bin/kotlinc -jvm-target foo + // error: unknown JVM target version: foo + // Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 + switch v { + case JAVA_VERSION_7: + return "1.6" + case JAVA_VERSION_9: + return "9" + default: + return v.String() + } +} + // Returns true if javac targeting this version uses system modules instead of a bootclasspath. func (v javaVersion) usesJavaModules() bool { return v >= 9 |