Skip to content

Commit c2819d6

Browse files
committed
Merge pull request #26769 from dreis2211
* gh-26769: Add Java 17 to JavaVersion enum Closes gh-26769
2 parents 6036cde + 0ea3b92 commit c2819d6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.system;
1818

19+
import java.io.Console;
1920
import java.lang.invoke.MethodHandles;
2021
import java.util.Arrays;
2122
import java.util.Collections;
@@ -77,7 +78,12 @@ public enum JavaVersion {
7778
/**
7879
* Java 16.
7980
*/
80-
SIXTEEN("16", Stream.class, "toList");
81+
SIXTEEN("16", Stream.class, "toList"),
82+
83+
/**
84+
* Java 17.
85+
*/
86+
SEVENTEEN("17", Console.class, "charset");
8187

8288
private final String name;
8389

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/JavaVersionTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -133,4 +133,10 @@ void currentJavaVersionSixteen() {
133133
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.SIXTEEN);
134134
}
135135

136+
@Test
137+
@EnabledOnJre(JRE.JAVA_17)
138+
void currentJavaVersionSeventeen() {
139+
assertThat(JavaVersion.getJavaVersion()).isEqualTo(JavaVersion.SEVENTEEN);
140+
}
141+
136142
}

0 commit comments

Comments
 (0)