Use Java 24 to build Spring Framework

This commit also adapts tests for a Java 24 runtime.

Closes gh-34639
This commit is contained in:
Brian Clozel 2025-03-24 09:51:19 +01:00
parent 274a689a10
commit b8b279d3e0
4 changed files with 8 additions and 6 deletions

View File

@ -44,7 +44,7 @@ public class JavaConventions {
/** /**
* The Java version we should use as the JVM baseline for building the project * The Java version we should use as the JVM baseline for building the project
*/ */
private static final JavaLanguageVersion DEFAULT_LANGUAGE_VERSION = JavaLanguageVersion.of(23); private static final JavaLanguageVersion DEFAULT_LANGUAGE_VERSION = JavaLanguageVersion.of(24);
/** /**
* The Java version we should use as the baseline for the compiled bytecode (the "-release" compiler argument) * The Java version we should use as the baseline for the compiled bytecode (the "-release" compiler argument)

View File

@ -95,9 +95,10 @@ class AspectJEnableCachingIsolatedTests {
} }
catch (NoUniqueBeanDefinitionException ex) { catch (NoUniqueBeanDefinitionException ex) {
assertThat(ex.getMessage()).contains( assertThat(ex.getMessage()).contains(
"no CacheResolver specified and expected single matching CacheManager but found 2: cm1,cm2"); "no CacheResolver specified and expected single matching CacheManager but found 2")
.contains("cm1", "cm2");
assertThat(ex.getNumberOfBeansFound()).isEqualTo(2); assertThat(ex.getNumberOfBeansFound()).isEqualTo(2);
assertThat(ex.getBeanNamesFound()).containsExactly("cm1", "cm2"); assertThat(ex.getBeanNamesFound()).containsExactlyInAnyOrder("cm1", "cm2");
} }
} }

View File

@ -94,9 +94,10 @@ class EnableCachingTests extends AbstractCacheAnnotationTests {
assertThatThrownBy(ctx::refresh) assertThatThrownBy(ctx::refresh)
.isInstanceOfSatisfying(NoUniqueBeanDefinitionException.class, ex -> { .isInstanceOfSatisfying(NoUniqueBeanDefinitionException.class, ex -> {
assertThat(ex.getMessage()).contains( assertThat(ex.getMessage()).contains(
"no CacheResolver specified and expected single matching CacheManager but found 2: cm1,cm2"); "no CacheResolver specified and expected single matching CacheManager but found 2")
.contains("cm1", "cm2");
assertThat(ex.getNumberOfBeansFound()).isEqualTo(2); assertThat(ex.getNumberOfBeansFound()).isEqualTo(2);
assertThat(ex.getBeanNamesFound()).containsExactly("cm1", "cm2"); assertThat(ex.getBeanNamesFound()).containsExactlyInAnyOrder("cm1", "cm2");
}).hasNoCause(); }).hasNoCause();
} }

View File

@ -228,7 +228,7 @@ class ConfigurationClassProcessingTests {
BeanFactory factory = initBeanFactory(true, ConfigWithMethodNameMismatch.class); BeanFactory factory = initBeanFactory(true, ConfigWithMethodNameMismatch.class);
SpousyTestBean foo = factory.getBean("foo", SpousyTestBean.class); SpousyTestBean foo = factory.getBean("foo", SpousyTestBean.class);
assertThat(foo.getName()).isEqualTo("foo1"); assertThat(foo.getName()).isIn("foo1", "foo2");
} }
@Test @Test