Merge branch '6.1.x'

This commit is contained in:
Stéphane Nicoll 2024-04-23 15:34:49 +02:00
commit a77895bd90
7 changed files with 29 additions and 29 deletions

View File

@ -166,7 +166,7 @@ public class SampleConfiguration {
@Bean @Bean
@NotNull @NotNull
public SampleBean sampleBean$demo_kotlin_internal_test() { public SampleBean sampleBean$demo_kotlin_internal_test() {
return new SampleBean(); return new SampleBean();
} }
} }
---- ----

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,9 +64,9 @@ class KotlinApplicationListenerMethodAdapterTests {
private class StaticApplicationListenerMethodAdapter(method: Method, private val targetBean: Any) : private class StaticApplicationListenerMethodAdapter(method: Method, private val targetBean: Any) :
ApplicationListenerMethodAdapter("unused", targetBean.javaClass, method) { ApplicationListenerMethodAdapter("unused", targetBean.javaClass, method) {
public override fun getTargetBean(): Any { public override fun getTargetBean(): Any {
return targetBean return targetBean
}
} }
}
@Suppress("RedundantSuspendModifier", "UNUSED_PARAMETER") @Suppress("RedundantSuspendModifier", "UNUSED_PARAMETER")
private class SampleEvents { private class SampleEvents {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -124,7 +124,7 @@ class InstrumentedMethodTests {
} }
@Test @Test
void classGetConstructorShouldMatchInstrospectPublicConstructorsHint() { void classGetConstructorShouldMatchIntrospectPublicConstructorsHint() {
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS); hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS);
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTOR, this.stringGetConstructor); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTOR, this.stringGetConstructor);
} }
@ -148,7 +148,7 @@ class InstrumentedMethodTests {
} }
@Test @Test
void classGetConstructorShouldMatchInstrospectConstructorHint() { void classGetConstructorShouldMatchIntrospectConstructorHint() {
hints.reflection().registerType(String.class,typeHint -> hints.reflection().registerType(String.class,typeHint ->
typeHint.withConstructor(Collections.emptyList(), ExecutableMode.INTROSPECT)); typeHint.withConstructor(Collections.emptyList(), ExecutableMode.INTROSPECT));
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTOR, this.stringGetConstructor); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTOR, this.stringGetConstructor);
@ -210,7 +210,7 @@ class InstrumentedMethodTests {
} }
@Test @Test
void classGetDeclaredConstructorShouldMatchInstrospectConstructorHint() { void classGetDeclaredConstructorShouldMatchIntrospectConstructorHint() {
hints.reflection().registerType(String.class, typeHint -> hints.reflection().registerType(String.class, typeHint ->
typeHint.withConstructor(TypeReference.listOf(byte[].class, byte.class), ExecutableMode.INTROSPECT)); typeHint.withConstructor(TypeReference.listOf(byte[].class, byte.class), ExecutableMode.INTROSPECT));
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETDECLAREDCONSTRUCTOR, this.stringGetDeclaredConstructor); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETDECLAREDCONSTRUCTOR, this.stringGetDeclaredConstructor);
@ -354,13 +354,13 @@ class InstrumentedMethodTests {
} }
@Test @Test
void classGetMethodsShouldMatchInstrospectDeclaredMethodsHint() { void classGetMethodsShouldMatchIntrospectDeclaredMethodsHint() {
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_DECLARED_METHODS); hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_DECLARED_METHODS);
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods);
} }
@Test @Test
void classGetMethodsShouldMatchInstrospectPublicMethodsHint() { void classGetMethodsShouldMatchIntrospectPublicMethodsHint() {
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS); hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS);
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods);
} }
@ -396,7 +396,7 @@ class InstrumentedMethodTests {
} }
@Test @Test
void classGetMethodShouldMatchInstrospectPublicMethodsHint() { void classGetMethodShouldMatchIntrospectPublicMethodsHint() {
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS); hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS);
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetToStringMethod); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetToStringMethod);
} }
@ -434,13 +434,13 @@ class InstrumentedMethodTests {
} }
@Test @Test
void classGetMethodShouldNotMatchInstrospectPublicMethodsHintWhenPrivate() { void classGetMethodShouldNotMatchIntrospectPublicMethodsHintWhenPrivate() {
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS); hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS);
assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetScaleMethod); assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetScaleMethod);
} }
@Test @Test
void classGetMethodShouldMatchInstrospectDeclaredMethodsHintWhenPrivate() { void classGetMethodShouldMatchIntrospectDeclaredMethodsHintWhenPrivate() {
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_DECLARED_METHODS); hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_DECLARED_METHODS);
assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetScaleMethod); assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetScaleMethod);
} }

View File

@ -432,12 +432,12 @@ public class TableMetaDataContext {
private final boolean quoting; private final boolean quoting;
public QuoteHandler(@Nullable String identifierQuoteString) { QuoteHandler(@Nullable String identifierQuoteString) {
this.identifierQuoteString = identifierQuoteString; this.identifierQuoteString = identifierQuoteString;
this.quoting = StringUtils.hasText(identifierQuoteString); this.quoting = StringUtils.hasText(identifierQuoteString);
} }
public void appendTo(StringBuilder stringBuilder, @Nullable String item) { void appendTo(StringBuilder stringBuilder, @Nullable String item) {
if (this.quoting) { if (this.quoting) {
stringBuilder.append(this.identifierQuoteString) stringBuilder.append(this.identifierQuoteString)
.append(item).append(this.identifierQuoteString); .append(item).append(this.identifierQuoteString);

View File

@ -44,7 +44,7 @@ import org.springframework.util.StringUtils;
* <li>{@code **} matches zero or more <em>path segments</em> until the end of the path</li> * <li>{@code **} matches zero or more <em>path segments</em> until the end of the path</li>
* <li><code>{spring}</code> matches a <em>path segment</em> and captures it as a variable named "spring"</li> * <li><code>{spring}</code> matches a <em>path segment</em> and captures it as a variable named "spring"</li>
* <li><code>{spring:[a-z]+}</code> matches the regexp {@code [a-z]+} against a path segment * <li><code>{spring:[a-z]+}</code> matches the regexp {@code [a-z]+} against a path segment
* and captures it a path variable named "spring"</li> * and captures it as a path variable named "spring"</li>
* <li><code>{*spring}</code> matches zero or more <em>path segments</em> until the end of the path * <li><code>{*spring}</code> matches zero or more <em>path segments</em> until the end of the path
* and captures it as a variable named "spring"</li> * and captures it as a variable named "spring"</li>
* </ul> * </ul>

View File

@ -238,7 +238,7 @@ class RestTemplateObservationTests {
@Nullable @Nullable
Observation currentObservation; Observation currentObservation;
public ObservationErrorHandler(TestObservationRegistry observationRegistry) { ObservationErrorHandler(TestObservationRegistry observationRegistry) {
this.observationRegistry = observationRegistry; this.observationRegistry = observationRegistry;
} }

View File

@ -38,7 +38,7 @@ class RouterFunctionDslTests {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "", true)
servletRequest.addHeader("bar", "bar") servletRequest.addHeader("bar", "bar")
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
@ -46,7 +46,7 @@ class RouterFunctionDslTests {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "/content", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "/content", true)
servletRequest.addHeader(ACCEPT, APPLICATION_ATOM_XML_VALUE) servletRequest.addHeader(ACCEPT, APPLICATION_ATOM_XML_VALUE)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
@ -54,7 +54,7 @@ class RouterFunctionDslTests {
val servletRequest = PathPatternsTestUtils.initRequest("POST", "/api/foo/", true) val servletRequest = PathPatternsTestUtils.initRequest("POST", "/api/foo/", true)
servletRequest.addHeader(ACCEPT, APPLICATION_JSON_VALUE) servletRequest.addHeader(ACCEPT, APPLICATION_JSON_VALUE)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
@ -63,7 +63,7 @@ class RouterFunctionDslTests {
servletRequest.addHeader(ACCEPT, APPLICATION_JSON_VALUE) servletRequest.addHeader(ACCEPT, APPLICATION_JSON_VALUE)
servletRequest.addHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE) servletRequest.addHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
@ -71,49 +71,49 @@ class RouterFunctionDslTests {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "/content", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "/content", true)
servletRequest.addHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM_VALUE) servletRequest.addHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM_VALUE)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
fun method() { fun method() {
val servletRequest = PathPatternsTestUtils.initRequest("PATCH", "/", true) val servletRequest = PathPatternsTestUtils.initRequest("PATCH", "/", true)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
fun path() { fun path() {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "/baz", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "/baz", true)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
fun pathExtension() { fun pathExtension() {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "/test.properties", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "/test.properties", true)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
fun resource() { fun resource() {
val servletRequest = PathPatternsTestUtils.initRequest("GET","/response2.txt", true) val servletRequest = PathPatternsTestUtils.initRequest("GET","/response2.txt", true)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
fun resources() { fun resources() {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "/resources/response.txt", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "/resources/response.txt", true)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
fun resourcesLookupFunction() { fun resourcesLookupFunction() {
val servletRequest = PathPatternsTestUtils.initRequest("GET", "/response.txt", true) val servletRequest = PathPatternsTestUtils.initRequest("GET", "/response.txt", true)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isTrue() assertThat(sampleRouter().route(request)).isPresent()
} }
@Test @Test
@ -123,7 +123,7 @@ class RouterFunctionDslTests {
servletRequest.addHeader(ACCEPT, APPLICATION_PDF_VALUE) servletRequest.addHeader(ACCEPT, APPLICATION_PDF_VALUE)
servletRequest.addHeader(CONTENT_TYPE, APPLICATION_PDF_VALUE) servletRequest.addHeader(CONTENT_TYPE, APPLICATION_PDF_VALUE)
val request = DefaultServerRequest(servletRequest, emptyList()) val request = DefaultServerRequest(servletRequest, emptyList())
assertThat(sampleRouter().route(request).isPresent).isFalse() assertThat(sampleRouter().route(request)).isNotPresent()
} }
@Test @Test