mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-27 14:22:47 +00:00
Fix Tests on JDK 21
Issue gh-13811
This commit is contained in:
parent
4905b91bdd
commit
33fb37e134
@ -144,6 +144,7 @@ subprojects {
|
|||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
options.compilerArgs.add("-parameters")
|
options.compilerArgs.add("-parameters")
|
||||||
|
options.release.set(17)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,20 +33,11 @@ public class JavaVersionTests {
|
|||||||
|
|
||||||
private static final int JDK17_CLASS_VERSION = 61;
|
private static final int JDK17_CLASS_VERSION = 61;
|
||||||
|
|
||||||
private static final int JDK21_CLASS_VERSION = 65;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@EnabledOnJre(JRE.JAVA_17)
|
|
||||||
public void authenticationWhenJdk17ThenCorrectJdkCompatibility() throws Exception {
|
public void authenticationWhenJdk17ThenCorrectJdkCompatibility() throws Exception {
|
||||||
assertClassVersion(Authentication.class, JDK17_CLASS_VERSION);
|
assertClassVersion(Authentication.class, JDK17_CLASS_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@EnabledOnJre(JRE.JAVA_21)
|
|
||||||
public void authenticationWhenJdk21ThenCorrectJdkCompatibility() throws Exception {
|
|
||||||
assertClassVersion(Authentication.class, JDK21_CLASS_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertClassVersion(Class<?> clazz, int classVersion) throws Exception {
|
private void assertClassVersion(Class<?> clazz, int classVersion) throws Exception {
|
||||||
String classResourceName = clazz.getName().replaceAll("\\.", "/") + ".class";
|
String classResourceName = clazz.getName().replaceAll("\\.", "/") + ".class";
|
||||||
try (InputStream input = Thread.currentThread().getContextClassLoader()
|
try (InputStream input = Thread.currentThread().getContextClassLoader()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user