From a41f97bc2bd547dbb635f032413fe586968912f8 Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Wed, 16 Nov 2022 08:07:01 +0000 Subject: [PATCH 001/468] Next development version (v5.3.25-SNAPSHOT) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 43490c3653c7..28a2627575e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=5.3.24-SNAPSHOT +version=5.3.25-SNAPSHOT org.gradle.jvmargs=-Xmx2048m org.gradle.caching=true org.gradle.parallel=true From a18842b72b779664bc9ae40714a86a08449958d9 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 18 Nov 2022 10:47:06 +0100 Subject: [PATCH 002/468] Fix link to WebFlux section Closes gh-29517 --- src/docs/asciidoc/web/integration.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/asciidoc/web/integration.adoc b/src/docs/asciidoc/web/integration.adoc index 62d0ef27516b..0acc0a918fe6 100644 --- a/src/docs/asciidoc/web/integration.adoc +++ b/src/docs/asciidoc/web/integration.adoc @@ -9,7 +9,7 @@ particular architecture, technology, or methodology (although it certainly recom some over others). This freedom to pick and choose the architecture, technology, or methodology that is most relevant to a developer and their development team is arguably most evident in the web area, where Spring provides its own web frameworks -(<> and <>) while, at the same time, +(<> and <>) while, at the same time, supporting integration with a number of popular third-party web frameworks. From 4f472d2ac480c9d698e6993d6849f2bc48792aef Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 19 Nov 2022 14:38:01 +0100 Subject: [PATCH 003/468] Remove TODOs in WebFlux ref docs --- src/docs/asciidoc/web/webflux.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/asciidoc/web/webflux.adoc b/src/docs/asciidoc/web/webflux.adoc index 52adcac4efde..175a37e08a8c 100644 --- a/src/docs/asciidoc/web/webflux.adoc +++ b/src/docs/asciidoc/web/webflux.adoc @@ -1975,7 +1975,7 @@ generally supported for all return values. value) is considered to have fully handled the response if it also has a `ServerHttpResponse`, a `ServerWebExchange` argument, or an `@ResponseStatus` annotation. The same is also true if the controller has made a positive ETag or `lastModified` timestamp check. - // TODO: See <> for details. + See <> for details. If none of the above is true, a `void` return type can also indicate "`no response body`" for REST controllers or default view name selection for HTML controllers. @@ -4194,7 +4194,7 @@ the example: } ---- -// TODO: See also <>. +See also <>. The resource handler also supports a chain of {api-spring-framework}/web/reactive/resource/ResourceResolver.html[`ResourceResolver`] implementations and From c7bd685c54df47f9a2c4809dab6e55e5f1cbe823 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 19 Nov 2022 14:38:39 +0100 Subject: [PATCH 004/468] Polishing --- src/docs/asciidoc/web/webflux.adoc | 2 +- src/docs/asciidoc/web/webmvc.adoc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/docs/asciidoc/web/webflux.adoc b/src/docs/asciidoc/web/webflux.adoc index 175a37e08a8c..1547a15808cd 100644 --- a/src/docs/asciidoc/web/webflux.adoc +++ b/src/docs/asciidoc/web/webflux.adoc @@ -4160,7 +4160,7 @@ In the next example, given a request that starts with `/resources`, the relative used to find and serve static resources relative to `/static` on the classpath. Resources are served with a one-year future expiration to ensure maximum use of the browser cache and a reduction in HTTP requests made by the browser. The `Last-Modified` header is also -evaluated and, if present, a `304` status code is returned. The following list shows +evaluated and, if present, a `304` status code is returned. The following listing shows the example: [source,java,indent=0,subs="verbatim,quotes",role="primary"] diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index daa67d080dcf..7086f403a964 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -3,15 +3,15 @@ :doc-spring-security: {doc-root}/spring-security/reference Spring Web MVC is the original web framework built on the Servlet API and has been included -in the Spring Framework from the very beginning. The formal name, "`Spring Web MVC,`" +in the Spring Framework from the very beginning. The formal name, "Spring Web MVC," comes from the name of its source module ({spring-framework-main-code}/spring-webmvc[`spring-webmvc`]), -but it is more commonly known as "`Spring MVC`". +but it is more commonly known as "Spring MVC". Parallel to Spring Web MVC, Spring Framework 5.0 introduced a reactive-stack web framework -whose name, "`Spring WebFlux,`" is also based on its source module +whose name, "Spring WebFlux," is also based on its source module ({spring-framework-main-code}/spring-webflux[`spring-webflux`]). -This section covers Spring Web MVC. The <> +This chapter covers Spring Web MVC. The <> covers Spring WebFlux. For baseline information and compatibility with Servlet container and Java EE version From cad6e8756d43f0710b02cf92a30c61f6fd3dbc61 Mon Sep 17 00:00:00 2001 From: divcon Date: Sat, 19 Nov 2022 10:56:40 +0900 Subject: [PATCH 005/468] Fix link to WebFlux section in reference manual Closes gh-29526 --- src/docs/asciidoc/web-reactive.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/asciidoc/web-reactive.adoc b/src/docs/asciidoc/web-reactive.adoc index 00d358f97d36..08156a1ed170 100644 --- a/src/docs/asciidoc/web-reactive.adoc +++ b/src/docs/asciidoc/web-reactive.adoc @@ -8,7 +8,7 @@ This part of the documentation covers support for reactive-stack web applications built on a https://www.reactive-streams.org/[Reactive Streams] API to run on non-blocking servers, such as Netty, Undertow, and Servlet 3.1+ containers. Individual chapters cover -the <> framework, +the <> framework, the reactive <>, support for <>, and <>. For Servlet-stack web applications, see <>. From 1ee3777ac79be7fd0fdad953ea1ec2ec9cf2f168 Mon Sep 17 00:00:00 2001 From: Marten Deinum Date: Mon, 21 Nov 2022 16:59:30 +0100 Subject: [PATCH 006/468] Fix link to Bean Utils Light Library in BeanUtils Javadoc The URL for the BULL library has changed (not sure when, probably way back). This updates it to the correct location. Closes gh-29534, gh-29536 --- .../src/main/java/org/springframework/beans/BeanUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java index 61b9541a12db..1fc33c2f6eaa 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanUtils.java @@ -62,7 +62,7 @@ *

Mainly for internal use within the framework, but to some degree also * useful for application classes. Consider * Apache Commons BeanUtils, - * BULL - Bean Utils Light Library, + * BULL - Bean Utils Light Library, * or similar third-party frameworks for more comprehensive bean utilities. * * @author Rod Johnson From 72b44cebea31e9db6faffa5c3e62b8f0d560e19b Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 21 Nov 2022 17:36:25 +0100 Subject: [PATCH 007/468] Catch Error for SourceHttpMessageConverter in WebMvcConfigurationSupport Prior to this commit, the addDefaultHttpMessageConverters() method in WebMvcConfigurationSupport caught Throwable for SourceHttpMessageConverter instantiation; whereas, the rest of the code base correctly catches Error for SourceHttpMessageConverter instantiation (to handle errors such as NoClassDefFoundError). Throwable should not be caught since it can mask other categories of failures (such as configuration errors). This commit therefore switches to catching Error for SourceHttpMessageConverter instantiation in WebMvcConfigurationSupport. Closes gh-29537 --- .../config/annotation/WebMvcConfigurationSupport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java index 262e9d9a3037..18c44d615117 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -907,8 +907,8 @@ protected final void addDefaultHttpMessageConverters(List()); } - catch (Throwable ex) { - // Ignore when no TransformerFactory implementation is available... + catch (Error err) { + // Ignore when no TransformerFactory implementation is available } } messageConverters.add(new AllEncompassingFormHttpMessageConverter()); From 00da70e26b9cb5ece2a9499e7c1b449e856b4aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Tue, 22 Nov 2022 08:35:50 +0100 Subject: [PATCH 008/468] Fix some typos in Kotlin WebClient example code Closes gh-29542 --- src/docs/asciidoc/web/webflux-webclient.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/docs/asciidoc/web/webflux-webclient.adoc b/src/docs/asciidoc/web/webflux-webclient.adoc index e93d1214046e..4ce800ced0fd 100644 --- a/src/docs/asciidoc/web/webflux-webclient.adoc +++ b/src/docs/asciidoc/web/webflux-webclient.adoc @@ -252,7 +252,7 @@ To configure a connection timeout: .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000); val webClient = WebClient.builder() - .clientConnector(new ReactorClientHttpConnector(httpClient)) + .clientConnector(ReactorClientHttpConnector(httpClient)) .build(); ---- @@ -280,8 +280,8 @@ To configure a read or write timeout: val httpClient = HttpClient.create() .doOnConnected { conn -> conn - .addHandlerLast(new ReadTimeoutHandler(10)) - .addHandlerLast(new WriteTimeoutHandler(10)) + .addHandlerLast(ReadTimeoutHandler(10)) + .addHandlerLast(WriteTimeoutHandler(10)) } // Create WebClient... @@ -357,7 +357,7 @@ The following example shows how to customize Jetty `HttpClient` settings: httpClient.cookieStore = ... val webClient = WebClient.builder() - .clientConnector(new JettyClientHttpConnector(httpClient)) + .clientConnector(JettyClientHttpConnector(httpClient)) .build(); ---- @@ -752,8 +752,8 @@ multipart request. The following example shows how to create a `MultiValueMap Date: Wed, 23 Nov 2022 11:17:58 +0100 Subject: [PATCH 009/468] Consistent use of DefaultParameterNameResolver in tests --- ...ierAnnotationAutowireBeanFactoryTests.java | 10 +++++----- ...ableTableParameterNameDiscovererTests.java | 18 ++++++++--------- .../SpringCoreBlockHoundIntegrationTests.java | 10 +++------- .../PayloadMethodArgumentResolverTests.java | 6 +++--- .../handler/invocation/ResolvableMethod.java | 6 +++--- .../InitBinderDataBinderFactoryTests.java | 4 ++-- .../method/annotation/ModelFactoryTests.java | 10 +++++----- .../testfixture/method/ResolvableMethod.java | 6 +++--- .../InitBinderBindingContextTests.java | 4 ++-- ...equestPartMethodArgumentResolverTests.java | 20 +++++++++---------- 10 files changed, 45 insertions(+), 49 deletions(-) diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java index f660a8af020d..fe190c8b9f5c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.config.DependencyDescriptor; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.MethodParameter; import org.springframework.util.ClassUtils; @@ -148,7 +148,7 @@ public void testAutowireCandidateWithConstructorDescriptor() throws Exception { lbf.registerBeanDefinition(MARK, person2); MethodParameter param = new MethodParameter(QualifiedTestBean.class.getDeclaredConstructor(Person.class), 0); DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(param, false); - param.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + param.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); assertThat(param.getParameterName()).isEqualTo("tpb"); assertThat(lbf.isAutowireCandidate(JUERGEN, null)).isTrue(); assertThat(lbf.isAutowireCandidate(JUERGEN, qualifiedDescriptor)).isTrue(); @@ -174,9 +174,9 @@ public void testAutowireCandidateWithMethodDescriptor() throws Exception { new MethodParameter(QualifiedTestBean.class.getDeclaredMethod("autowireNonqualified", Person.class), 0); DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(qualifiedParam, false); DependencyDescriptor nonqualifiedDescriptor = new DependencyDescriptor(nonqualifiedParam, false); - qualifiedParam.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + qualifiedParam.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); assertThat(qualifiedParam.getParameterName()).isEqualTo("tpb"); - nonqualifiedParam.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + nonqualifiedParam.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); assertThat(nonqualifiedParam.getParameterName()).isEqualTo("tpb"); assertThat(lbf.isAutowireCandidate(JUERGEN, null)).isTrue(); assertThat(lbf.isAutowireCandidate(JUERGEN, nonqualifiedDescriptor)).isTrue(); diff --git a/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java b/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java index 4ab6fc86967c..db7ccb5efe76 100644 --- a/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java +++ b/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ */ class LocalVariableTableParameterNameDiscovererTests { - private final LocalVariableTableParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer(); + private final ParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer(); @Test @@ -162,23 +162,23 @@ void generifiedClass() throws Exception { Constructor ctor = clazz.getDeclaredConstructor(Object.class); String[] names = discoverer.getParameterNames(ctor); - assertThat(names.length).isEqualTo(1); + assertThat(names).hasSize(1); assertThat(names[0]).isEqualTo("key"); ctor = clazz.getDeclaredConstructor(Object.class, Object.class); names = discoverer.getParameterNames(ctor); - assertThat(names.length).isEqualTo(2); + assertThat(names).hasSize(2); assertThat(names[0]).isEqualTo("key"); assertThat(names[1]).isEqualTo("value"); Method m = clazz.getMethod("generifiedStaticMethod", Object.class); names = discoverer.getParameterNames(m); - assertThat(names.length).isEqualTo(1); + assertThat(names).hasSize(1); assertThat(names[0]).isEqualTo("param"); m = clazz.getMethod("generifiedMethod", Object.class, long.class, Object.class, Object.class); names = discoverer.getParameterNames(m); - assertThat(names.length).isEqualTo(4); + assertThat(names).hasSize(4); assertThat(names[0]).isEqualTo("param"); assertThat(names[1]).isEqualTo("x"); assertThat(names[2]).isEqualTo("key"); @@ -186,21 +186,21 @@ void generifiedClass() throws Exception { m = clazz.getMethod("voidStaticMethod", Object.class, long.class, int.class); names = discoverer.getParameterNames(m); - assertThat(names.length).isEqualTo(3); + assertThat(names).hasSize(3); assertThat(names[0]).isEqualTo("obj"); assertThat(names[1]).isEqualTo("x"); assertThat(names[2]).isEqualTo("i"); m = clazz.getMethod("nonVoidStaticMethod", Object.class, long.class, int.class); names = discoverer.getParameterNames(m); - assertThat(names.length).isEqualTo(3); + assertThat(names).hasSize(3); assertThat(names[0]).isEqualTo("obj"); assertThat(names[1]).isEqualTo("x"); assertThat(names[2]).isEqualTo("i"); m = clazz.getMethod("getDate"); names = discoverer.getParameterNames(m); - assertThat(names.length).isEqualTo(0); + assertThat(names).isEmpty(); } @Disabled("Ignored because Ubuntu packages OpenJDK with debug symbols enabled. See SPR-8078.") diff --git a/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java b/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java index ea4b7fbbd552..c12a31cb602a 100644 --- a/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java +++ b/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledForJreRange; import reactor.blockhound.BlockHound; import reactor.core.scheduler.ReactorBlockHoundIntegration; import reactor.core.scheduler.Schedulers; @@ -32,7 +31,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.condition.JRE.JAVA_14; /** * Tests to verify the spring-core BlockHound integration rules. @@ -40,14 +38,12 @@ * @author Rossen Stoyanchev * @since 5.2.4 */ -@DisabledForJreRange(min = JAVA_14) public class SpringCoreBlockHoundIntegrationTests { - @BeforeAll - static void setUp() { + static void setup() { BlockHound.builder() - .with(new ReactorBlockHoundIntegration()) // Reactor non-blocking thread predicate + .with(new ReactorBlockHoundIntegration()) // Reactor non-blocking thread predicate .with(new ReactiveAdapterRegistry.SpringCoreBlockHoundIntegration()) .install(); } diff --git a/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolverTests.java b/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolverTests.java index 2e71ce8815e5..1535df80cbab 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolverTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.MethodParameter; import org.springframework.core.annotation.SynthesizingMethodParameter; import org.springframework.messaging.Message; @@ -81,7 +81,7 @@ public void setup() throws Exception { this.paramAnnotatedRequired = new SynthesizingMethodParameter(payloadMethod, 2); this.paramWithSpelExpression = new SynthesizingMethodParameter(payloadMethod, 3); this.paramValidated = new SynthesizingMethodParameter(payloadMethod, 4); - this.paramValidated.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + this.paramValidated.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); this.paramValidatedNotAnnotated = new SynthesizingMethodParameter(payloadMethod, 5); this.paramNotAnnotated = new SynthesizingMethodParameter(payloadMethod, 6); } diff --git a/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/ResolvableMethod.java b/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/ResolvableMethod.java index 1abfbcfd8a94..2de8f1364c72 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/ResolvableMethod.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/ResolvableMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ import org.springframework.cglib.proxy.Enhancer; import org.springframework.cglib.proxy.Factory; import org.springframework.cglib.proxy.MethodProxy; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.MethodIntrospector; import org.springframework.core.MethodParameter; import org.springframework.core.ParameterNameDiscoverer; @@ -131,7 +131,7 @@ public class ResolvableMethod { private static final SpringObjenesis objenesis = new SpringObjenesis(); - private static final ParameterNameDiscoverer nameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); + private static final ParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer(); // Matches ValueConstants.DEFAULT_NONE (spring-web and spring-messaging) private static final String DEFAULT_VALUE_NONE = "\n\t\t\n\t\t\n\uE000\uE001\uE002\n\t\t\t\t\n"; diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java index ce284f935e71..08fd411307c4 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.convert.ConversionService; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.web.bind.WebDataBinder; @@ -128,7 +128,7 @@ private WebDataBinderFactory createFactory(String methodName, Class... parame InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(handler, method); handlerMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers); handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null)); - handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); + handlerMethod.setParameterNameDiscoverer(new DefaultParameterNameDiscoverer()); return new InitBinderDataBinderFactory( Collections.singletonList(handlerMethod), this.bindingInitializer); diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java index 1275c08b6950..f859cb880f06 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; @@ -177,7 +177,7 @@ public void updateModelBindingResult() throws Exception { assertThat(container.getModel().get(commandName)).isEqualTo(command); String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + commandName; assertThat(container.getModel().get(bindingResultKey)).isSameAs(dataBinder.getBindingResult()); - assertThat(container.getModel().size()).isEqualTo(2); + assertThat(container.getModel()).hasSize(2); } @Test @@ -240,7 +240,7 @@ public void updateModelWhenRedirecting() throws Exception { modelFactory.updateModel(this.webRequest, container); assertThat(container.getModel().get(queryParamName)).isEqualTo(queryParam); - assertThat(container.getModel().size()).isEqualTo(1); + assertThat(container.getModel()).hasSize(1); assertThat(this.attributeStore.retrieveAttribute(this.webRequest, attributeName)).isEqualTo(attribute); } @@ -252,7 +252,7 @@ private ModelFactory createModelFactory(String methodName, Class... parameter InvocableHandlerMethod modelMethod = createHandlerMethod(methodName, parameterTypes); modelMethod.setHandlerMethodArgumentResolvers(resolvers); modelMethod.setDataBinderFactory(null); - modelMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); + modelMethod.setParameterNameDiscoverer(new DefaultParameterNameDiscoverer()); return new ModelFactory(Collections.singletonList(modelMethod), null, this.attributeHandler); } diff --git a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/method/ResolvableMethod.java b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/method/ResolvableMethod.java index 6ccef862b459..f1967eb83c43 100644 --- a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/method/ResolvableMethod.java +++ b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/method/ResolvableMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ import org.springframework.cglib.proxy.Enhancer; import org.springframework.cglib.proxy.Factory; import org.springframework.cglib.proxy.MethodProxy; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.MethodIntrospector; import org.springframework.core.MethodParameter; import org.springframework.core.ParameterNameDiscoverer; @@ -130,7 +130,7 @@ public class ResolvableMethod { private static final SpringObjenesis objenesis = new SpringObjenesis(); - private static final ParameterNameDiscoverer nameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); + private static final ParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer(); // Matches ValueConstants.DEFAULT_NONE (spring-web and spring-messaging) private static final String DEFAULT_VALUE_NONE = "\n\t\t\n\t\t\n\uE000\uE001\uE002\n\t\t\t\t\n"; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java index d695a3f750c6..5233a4a52ec6 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.core.convert.ConversionService; import org.springframework.format.support.DefaultFormattingConversionService; @@ -131,7 +131,7 @@ private BindingContext createBindingContext(String methodName, Class... param SyncInvocableHandlerMethod handlerMethod = new SyncInvocableHandlerMethod(handler, method); handlerMethod.setArgumentResolvers(new ArrayList<>(this.argumentResolvers)); - handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); + handlerMethod.setParameterNameDiscoverer(new DefaultParameterNameDiscoverer()); return new InitBinderBindingContext(this.bindingInitializer, Collections.singletonList(handlerMethod)); } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java index cbde3c20b23f..bcf9fe69d559 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java @@ -33,7 +33,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.MethodParameter; import org.springframework.core.annotation.SynthesizingMethodParameter; import org.springframework.http.HttpInputMessage; @@ -138,7 +138,7 @@ public InputStream getInputStream() throws IOException { Method method = ReflectionUtils.findMethod(getClass(), "handle", (Class[]) null); paramRequestPart = new SynthesizingMethodParameter(method, 0); - paramRequestPart.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + paramRequestPart.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); paramNamedRequestPart = new SynthesizingMethodParameter(method, 1); paramValidRequestPart = new SynthesizingMethodParameter(method, 2); paramMultipartFile = new SynthesizingMethodParameter(method, 3); @@ -146,20 +146,20 @@ public InputStream getInputStream() throws IOException { paramMultipartFileArray = new SynthesizingMethodParameter(method, 5); paramInt = new SynthesizingMethodParameter(method, 6); paramMultipartFileNotAnnot = new SynthesizingMethodParameter(method, 7); - paramMultipartFileNotAnnot.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + paramMultipartFileNotAnnot.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); paramPart = new SynthesizingMethodParameter(method, 8); - paramPart.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + paramPart.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); paramPartList = new SynthesizingMethodParameter(method, 9); paramPartArray = new SynthesizingMethodParameter(method, 10); paramRequestParamAnnot = new SynthesizingMethodParameter(method, 11); optionalMultipartFile = new SynthesizingMethodParameter(method, 12); - optionalMultipartFile.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + optionalMultipartFile.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); optionalMultipartFileList = new SynthesizingMethodParameter(method, 13); - optionalMultipartFileList.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + optionalMultipartFileList.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); optionalPart = new SynthesizingMethodParameter(method, 14); - optionalPart.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + optionalPart.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); optionalPartList = new SynthesizingMethodParameter(method, 15); - optionalPartList.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); + optionalPartList.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); optionalRequestPart = new SynthesizingMethodParameter(method, 16); } @@ -204,7 +204,7 @@ public void resolveMultipartFileArray() throws Exception { assertThat(actual).isNotNull(); assertThat(actual instanceof MultipartFile[]).isTrue(); MultipartFile[] parts = (MultipartFile[]) actual; - assertThat(parts.length).isEqualTo(2); + assertThat(parts).hasSize(2); assertThat(multipartFile1).isEqualTo(parts[0]); assertThat(multipartFile2).isEqualTo(parts[1]); } @@ -270,7 +270,7 @@ public void resolvePartArrayArgument() throws Exception { Object result = resolver.resolveArgument(paramPartArray, null, webRequest, null); assertThat(result instanceof Part[]).isTrue(); Part[] parts = (Part[]) result; - assertThat(parts.length).isEqualTo(2); + assertThat(parts).hasSize(2); assertThat(part1).isEqualTo(parts[0]); assertThat(part2).isEqualTo(parts[1]); } From 7de8d81932c1a17d06f247b67110c3c9016fcc9d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 24 Nov 2022 14:25:43 +0100 Subject: [PATCH 010/468] Explicit documentation notes on standard Java reflection See gh-29531 --- .../core/DefaultParameterNameDiscoverer.java | 8 ++++---- .../core/KotlinReflectionParameterNameDiscoverer.java | 6 ++++-- .../core/LocalVariableTableParameterNameDiscoverer.java | 6 ++++++ .../core/StandardReflectionParameterNameDiscoverer.java | 7 ++++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java index f4dca0f99688..6d6dc7892fd3 100644 --- a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ /** * Default implementation of the {@link ParameterNameDiscoverer} strategy interface, - * using the Java 8 standard reflection mechanism (if available), and falling back - * to the ASM-based {@link LocalVariableTableParameterNameDiscoverer} for checking - * debug information in the class file. + * using the Java 8 standard reflection mechanism, and falling back to the ASM-based + * {@link LocalVariableTableParameterNameDiscoverer} for checking debug information + * in the class file (e.g. for classes compiled with earlier Java versions). * *

If a Kotlin reflection implementation is present, * {@link KotlinReflectionParameterNameDiscoverer} is added first in the list and diff --git a/spring-core/src/main/java/org/springframework/core/KotlinReflectionParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/KotlinReflectionParameterNameDiscoverer.java index 01700431612d..61799e7ddcf6 100644 --- a/spring-core/src/main/java/org/springframework/core/KotlinReflectionParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/KotlinReflectionParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,13 @@ * {@link ParameterNameDiscoverer} implementation which uses Kotlin's reflection facilities * for introspecting parameter names. * - * Compared to {@link StandardReflectionParameterNameDiscoverer}, it allows in addition to + *

Compared to {@link StandardReflectionParameterNameDiscoverer}, it allows in addition to * determine interface parameter names without requiring Java 8 -parameters compiler flag. * * @author Sebastien Deleuze * @since 5.0 + * @see StandardReflectionParameterNameDiscoverer + * @see DefaultParameterNameDiscoverer */ public class KotlinReflectionParameterNameDiscoverer implements ParameterNameDiscoverer { diff --git a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index f20807f1190f..7805c2a1bf3f 100644 --- a/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -47,12 +47,18 @@ * caches the ASM discovered information for each introspected Class, in a thread-safe * manner. It is recommended to reuse ParameterNameDiscoverer instances as far as possible. * + *

This discoverer variant is effectively superseded by the Java 8 based + * {@link StandardReflectionParameterNameDiscoverer} but included as a fallback still + * (for code not compiled with the standard "-parameters" compiler flag). + * * @author Adrian Colyer * @author Costin Leau * @author Juergen Hoeller * @author Chris Beams * @author Sam Brannen * @since 2.0 + * @see StandardReflectionParameterNameDiscoverer + * @see DefaultParameterNameDiscoverer */ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameDiscoverer { diff --git a/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java index 665befa0bcbe..9bce47f435b4 100644 --- a/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,15 @@ * {@link ParameterNameDiscoverer} implementation which uses JDK 8's reflection facilities * for introspecting parameter names (based on the "-parameters" compiler flag). * + *

This is a key element of {@link DefaultParameterNameDiscoverer} where it is being + * combined with {@link KotlinReflectionParameterNameDiscoverer} if Kotlin is present. + * * @author Juergen Hoeller * @since 4.0 * @see java.lang.reflect.Method#getParameters() * @see java.lang.reflect.Parameter#getName() + * @see KotlinReflectionParameterNameDiscoverer + * @see DefaultParameterNameDiscoverer */ public class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer { From a11222f681090ecb5557907e08023c34be3884f2 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 25 Nov 2022 17:58:59 +0100 Subject: [PATCH 011/468] Polishing --- .../http/client/reactive/JettyHeadersAdapter.java | 3 +-- .../http/server/reactive/JettyHeadersAdapter.java | 3 +-- .../socket/adapter/AbstractListenerWebSocketSession.java | 2 +- .../web/reactive/socket/client/TomcatWebSocketClient.java | 7 ++++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/JettyHeadersAdapter.java b/spring-web/src/main/java/org/springframework/http/client/reactive/JettyHeadersAdapter.java index f44362c9c3a2..7b2f3a245884 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/JettyHeadersAdapter.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/JettyHeadersAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -170,7 +170,6 @@ public Set>> entrySet() { public Iterator>> iterator() { return new EntryIterator(); } - @Override public int size() { return headers.size(); diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/JettyHeadersAdapter.java b/spring-web/src/main/java/org/springframework/http/server/reactive/JettyHeadersAdapter.java index 357662872860..d325dc4c7a24 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/JettyHeadersAdapter.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/JettyHeadersAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -170,7 +170,6 @@ public Set>> entrySet() { public Iterator>> iterator() { return new EntryIterator(); } - @Override public int size() { return headers.size(); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java index 9bf0246b4ec4..5d9200816602 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java @@ -42,7 +42,7 @@ /** * Base class for {@link WebSocketSession} implementations that bridge between - * event-listener WebSocket APIs (e.g. Java WebSocket API JSR-356, Jetty, + * event-listener WebSocket APIs (e.g. Java WebSocket API (JSR-356), Jetty, * Undertow) and Reactive Streams. * *

Also implements {@code Subscriber} so it can be used to subscribe to diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java index 8310268db4a6..3304c80c945c 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,14 +27,15 @@ import org.springframework.web.reactive.socket.adapter.TomcatWebSocketSession; /** - * {@link WebSocketClient} implementation for use with the Java WebSocket API. + * {@link WebSocketClient} implementation for use with Tomcat, + * based on the Java WebSocket API. * * @author Violeta Georgieva * @since 5.0 + * @see StandardWebSocketClient */ public class TomcatWebSocketClient extends StandardWebSocketClient { - public TomcatWebSocketClient() { this(new WsWebSocketContainer()); } From 92b2b828f5e4139b5faaed4d0c20d512d62c8e0e Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 28 Nov 2022 10:17:56 +0100 Subject: [PATCH 012/468] Fix Java 17 test CI and remove Java 11 variant This commit fixes configuration and runtime issues with the Java 17 test CI variant and removes the Java 11 one, now that Spring Framework 5.3.x is in maintenance mode. --- ci/images/ci-image/Dockerfile | 1 - ci/images/get-jdk-url.sh | 6 --- ci/images/setup.sh | 2 +- ci/pipeline.yml | 40 +------------------ ci/scripts/check-project.sh | 2 +- gradle/toolchains.gradle | 19 ++------- .../SpringCoreBlockHoundIntegrationTests.java | 3 ++ .../util/StreamUtilsTests.java | 20 +++------- 8 files changed, 17 insertions(+), 76 deletions(-) diff --git a/ci/images/ci-image/Dockerfile b/ci/images/ci-image/Dockerfile index 0548a7c6b230..8c16e2bad2b4 100644 --- a/ci/images/ci-image/Dockerfile +++ b/ci/images/ci-image/Dockerfile @@ -5,7 +5,6 @@ ADD get-jdk-url.sh /get-jdk-url.sh RUN ./setup.sh java8 ENV JAVA_HOME /opt/openjdk/java8 -ENV JDK11 /opt/openjdk/java11 ENV JDK17 /opt/openjdk/java17 ENV PATH $JAVA_HOME/bin:$PATH diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh index ecf692e51726..bada29e91d7c 100755 --- a/ci/images/get-jdk-url.sh +++ b/ci/images/get-jdk-url.sh @@ -5,15 +5,9 @@ case "$1" in java8) echo "https://github.com/bell-sw/Liberica/releases/download/8u345+1/bellsoft-jdk8u345+1-linux-amd64.tar.gz" ;; - java11) - echo "https://github.com/bell-sw/Liberica/releases/download/11.0.16+8/bellsoft-jdk11.0.16+8-linux-amd64.tar.gz" - ;; java17) echo "https://github.com/bell-sw/Liberica/releases/download/17.0.4+8/bellsoft-jdk17.0.4+8-linux-amd64.tar.gz" ;; - java18) - echo "https://github.com/bell-sw/Liberica/releases/download/18.0.2+10/bellsoft-jdk18.0.2+10-linux-amd64.tar.gz" - ;; *) echo $"Unknown java version" exit 1 diff --git a/ci/images/setup.sh b/ci/images/setup.sh index f7add2e15cb0..e4c83004f784 100755 --- a/ci/images/setup.sh +++ b/ci/images/setup.sh @@ -20,7 +20,7 @@ curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/c mkdir -p /opt/openjdk pushd /opt/openjdk > /dev/null -for jdk in java8 java11 java17 +for jdk in java8 java17 do JDK_URL=$( /get-jdk-url.sh $jdk ) mkdir $jdk diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 5f7e91ba4661..7442b767a869 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -125,14 +125,6 @@ resources: access_token: ((github-ci-status-token)) branch: ((branch)) context: build -- name: repo-status-jdk11-build - type: github-status-resource - icon: eye-check-outline - source: - repository: ((github-repo-name)) - access_token: ((github-ci-status-token)) - branch: ((branch)) - context: jdk11-build - name: repo-status-jdk17-build type: github-status-resource icon: eye-check-outline @@ -237,34 +229,6 @@ jobs: "zip.type": "schema" get_params: threads: 8 -- name: jdk11-build - serial: true - public: true - plan: - - get: ci-image - - get: git-repo - - get: every-morning - trigger: true - - put: repo-status-jdk11-build - params: { state: "pending", commit: "git-repo" } - - do: - - task: check-project - image: ci-image - file: git-repo/ci/tasks/check-project.yml - privileged: true - timeout: ((task-timeout)) - params: - TEST_TOOLCHAIN: 11 - <<: *build-project-task-params - on_failure: - do: - - put: repo-status-jdk11-build - params: { state: "failure", commit: "git-repo" } - - put: slack-alert - params: - <<: *slack-fail-params - - put: repo-status-jdk11-build - params: { state: "success", commit: "git-repo" } - name: jdk17-build serial: true public: true @@ -282,7 +246,7 @@ jobs: privileged: true timeout: ((task-timeout)) params: - TEST_TOOLCHAIN: 15 + TEST_TOOLCHAIN: 17 <<: *build-project-task-params on_failure: do: @@ -471,7 +435,7 @@ jobs: groups: - name: "builds" - jobs: ["build", "jdk11-build", "jdk17-build"] + jobs: ["build", "jdk17-build"] - name: "releases" jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"] - name: "ci-images" diff --git a/ci/scripts/check-project.sh b/ci/scripts/check-project.sh index 7f6ca04cea9b..0620dc17164d 100755 --- a/ci/scripts/check-project.sh +++ b/ci/scripts/check-project.sh @@ -4,6 +4,6 @@ set -e source $(dirname $0)/common.sh pushd git-repo > /dev/null -./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK11,JDK15 \ +./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK17 \ -PmainToolchain=${MAIN_TOOLCHAIN} -PtestToolchain=${TEST_TOOLCHAIN} --no-daemon --max-workers=4 check popd > /dev/null diff --git a/gradle/toolchains.gradle b/gradle/toolchains.gradle index 5573efa1a52d..087f771f5cd7 100644 --- a/gradle/toolchains.gradle +++ b/gradle/toolchains.gradle @@ -81,6 +81,10 @@ plugins.withType(JavaPlugin) { javaLauncher = javaToolchains.launcherFor { languageVersion = testLanguageVersion } + if(testLanguageVersion == JavaLanguageVersion.of(17)) { + jvmArgs(["--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-opens=java.base/java.util=ALL-UNNAMED"]) + } } } } @@ -130,21 +134,6 @@ pluginManager.withPlugin("kotlin") { } } } - - if (testToolchainConfigured()) { - def testLanguageVersion = testToolchainLanguageVersion() - def compiler = javaToolchains.compilerFor { - languageVersion = testLanguageVersion - } - // See https://kotlinlang.org/docs/gradle.html#attributes-specific-for-jvm - def javaVersion = testLanguageVersion.toString() == '8' ? '1.8' : testLanguageVersion.toString() - compileTestKotlin { - kotlinOptions { - jvmTarget = javaVersion - jdkHome = compiler.get().metadata.installationPath.asFile.absolutePath - } - } - } } // Configure the JMH plugin to use the toolchain for generating and running JMH bytecode diff --git a/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java b/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java index c12a31cb602a..6a9b9596c0c7 100644 --- a/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java +++ b/spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledForJreRange; import reactor.blockhound.BlockHound; import reactor.core.scheduler.ReactorBlockHoundIntegration; import reactor.core.scheduler.Schedulers; @@ -31,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.condition.JRE.JAVA_14; /** * Tests to verify the spring-core BlockHound integration rules. @@ -38,6 +40,7 @@ * @author Rossen Stoyanchev * @since 5.2.4 */ +@DisabledForJreRange(min = JAVA_14) public class SpringCoreBlockHoundIntegrationTests { @BeforeAll diff --git a/spring-core/src/test/java/org/springframework/util/StreamUtilsTests.java b/spring-core/src/test/java/org/springframework/util/StreamUtilsTests.java index 21f0829457b3..6558b8d7db21 100644 --- a/spring-core/src/test/java/org/springframework/util/StreamUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/StreamUtilsTests.java @@ -33,8 +33,6 @@ import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; /** * Tests for {@link StreamUtils}. @@ -57,53 +55,47 @@ void setup() { @Test void copyToByteArray() throws Exception { - InputStream inputStream = spy(new ByteArrayInputStream(bytes)); + InputStream inputStream = new ByteArrayInputStream(bytes); byte[] actual = StreamUtils.copyToByteArray(inputStream); assertThat(actual).isEqualTo(bytes); - verify(inputStream, never()).close(); } @Test void copyToString() throws Exception { Charset charset = Charset.defaultCharset(); - InputStream inputStream = spy(new ByteArrayInputStream(string.getBytes(charset))); + InputStream inputStream = new ByteArrayInputStream(string.getBytes(charset)); String actual = StreamUtils.copyToString(inputStream, charset); assertThat(actual).isEqualTo(string); - verify(inputStream, never()).close(); } @Test void copyBytes() throws Exception { - ByteArrayOutputStream out = spy(new ByteArrayOutputStream()); + ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamUtils.copy(bytes, out); assertThat(out.toByteArray()).isEqualTo(bytes); - verify(out, never()).close(); } @Test void copyString() throws Exception { Charset charset = Charset.defaultCharset(); - ByteArrayOutputStream out = spy(new ByteArrayOutputStream()); + ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamUtils.copy(string, charset, out); assertThat(out.toByteArray()).isEqualTo(string.getBytes(charset)); - verify(out, never()).close(); } @Test void copyStream() throws Exception { - ByteArrayOutputStream out = spy(new ByteArrayOutputStream()); + ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamUtils.copy(new ByteArrayInputStream(bytes), out); assertThat(out.toByteArray()).isEqualTo(bytes); - verify(out, never()).close(); } @Test void copyRange() throws Exception { - ByteArrayOutputStream out = spy(new ByteArrayOutputStream()); + ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamUtils.copyRange(new ByteArrayInputStream(bytes), out, 0, 100); byte[] range = Arrays.copyOfRange(bytes, 0, 101); assertThat(out.toByteArray()).isEqualTo(range); - verify(out, never()).close(); } @Test From 332d2a36bb92021739ad5a083923467bf21be6ef Mon Sep 17 00:00:00 2001 From: Aashay Chapatwala <49100046+Aashay-Chapatwala@users.noreply.github.com> Date: Mon, 28 Nov 2022 14:20:30 +0530 Subject: [PATCH 013/468] Add title to SockJS iFrames for accessibility compliance Closes gh-29594 --- .../web/socket/sockjs/support/AbstractSockJsService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java index 39f6d2436b19..e6a239704afd 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -620,6 +620,7 @@ private class IframeHandler implements SockJsRequestHandler { "\n" + " \n" + " \n" + + " SocketJS iframe\n" + "