Add Java 21 as a known version

Bug: 335612268
Test: Set java_version to 21 in core-all && m
Change-Id: Ie2093187cec75949ae3bb4903edfb6f62aa31f6e
This commit is contained in:
Sorin Basca 2024-04-19 10:45:55 +01:00
parent c0df1afc07
commit 1fe2cc883f

View file

@ -587,6 +587,7 @@ const (
JAVA_VERSION_9 = 9
JAVA_VERSION_11 = 11
JAVA_VERSION_17 = 17
JAVA_VERSION_21 = 21
)
func (v javaVersion) String() string {
@ -605,6 +606,8 @@ func (v javaVersion) String() string {
return "11"
case JAVA_VERSION_17:
return "17"
case JAVA_VERSION_21:
return "21"
default:
return "unsupported"
}
@ -647,6 +650,8 @@ func normalizeJavaVersion(ctx android.BaseModuleContext, javaVersion string) jav
return JAVA_VERSION_11
case "17":
return JAVA_VERSION_17
case "21":
return JAVA_VERSION_21
case "10", "12", "13", "14", "15", "16":
ctx.PropertyErrorf("java_version", "Java language level %s is not supported", javaVersion)
return JAVA_VERSION_UNSUPPORTED