Skip to content

Commit ce3be72

Browse files
committed
Polish
1 parent 3e3f046 commit ce3be72

File tree

18 files changed

+49
-51
lines changed

18 files changed

+49
-51
lines changed

framework-docs/src/docs/asciidoc/web/webmvc.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4777,7 +4777,7 @@ directly. For example:
47774777
ContextSnapshot snapshot = ContextSnapshot.captureAll();
47784778
47794779
// On a different thread: restore ThreadLocal values
4780-
try (ContextSnapshot.Scope scoped = snapshot.setThreadLocals()) {
4780+
try (ContextSnapshot.Scope scope = snapshot.setThreadLocals()) {
47814781
// ...
47824782
}
47834783
----

spring-context/src/test/kotlin/org/springframework/context/aot/KotlinReflectionBeanRegistrationAotProcessorTests.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616

1717
package org.springframework.context.aot
1818

19-
import org.assertj.core.api.Assertions
19+
import org.assertj.core.api.Assertions.assertThat
2020
import org.junit.jupiter.api.Test
2121
import org.mockito.Mockito
22-
import org.springframework.aot.generate.GenerationContext
2322
import org.springframework.aot.hint.MemberCategory
2423
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates
2524
import org.springframework.aot.test.generate.TestGenerationContext
@@ -41,20 +40,20 @@ class KotlinReflectionBeanRegistrationAotProcessorTests {
4140

4241
@Test
4342
fun processorIsRegistered() {
44-
Assertions.assertThat(
43+
assertThat(
4544
AotServices.factories(javaClass.classLoader).load(BeanRegistrationAotProcessor::class.java))
4645
.anyMatch(KotlinReflectionBeanRegistrationAotProcessor::class.java::isInstance)
4746
}
4847

4948
@Test
5049
fun shouldProcessKotlinBean() {
5150
process(SampleKotlinBean::class.java)
52-
Assertions.assertThat(
51+
assertThat(
5352
RuntimeHintsPredicates.reflection()
5453
.onType(SampleKotlinBean::class.java)
5554
.withMemberCategory(MemberCategory.INTROSPECT_DECLARED_METHODS)
5655
).accepts(generationContext.runtimeHints)
57-
Assertions.assertThat(
56+
assertThat(
5857
RuntimeHintsPredicates.reflection()
5958
.onType(BaseKotlinBean::class.java)
6059
.withMemberCategory(MemberCategory.INTROSPECT_DECLARED_METHODS)
@@ -64,7 +63,7 @@ class KotlinReflectionBeanRegistrationAotProcessorTests {
6463
@Test
6564
fun shouldNotProcessJavaBean() {
6665
process(SampleJavaBean::class.java)
67-
Assertions.assertThat(generationContext.runtimeHints.reflection().typeHints()).isEmpty()
66+
assertThat(generationContext.runtimeHints.reflection().typeHints()).isEmpty()
6867
}
6968

7069
private fun process(beanClass: Class<*>) {

spring-context/src/test/kotlin/org/springframework/validation/beanvalidation/KotlinMethodValidationTests.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import jakarta.validation.ValidationException
2020
import jakarta.validation.Validator
2121
import jakarta.validation.constraints.NotEmpty
2222
import kotlinx.coroutines.runBlocking
23-
import org.assertj.core.api.Assertions
23+
import org.assertj.core.api.Assertions.assertThat
24+
import org.assertj.core.api.Assertions.assertThatExceptionOfType
2425
import org.junit.jupiter.api.Test
2526
import org.springframework.aop.framework.ProxyFactory
2627
import org.springframework.validation.annotation.Validated
@@ -41,8 +42,8 @@ class KotlinMethodValidationTests {
4142
validator.afterPropertiesSet()
4243
proxyFactory.addAdvice(MethodValidationInterceptor(validator as Validator))
4344
val proxy = proxyFactory.getProxy() as MyValidBean
44-
Assertions.assertThat(proxy.validName("name")).isEqualTo("name")
45-
Assertions.assertThatExceptionOfType(ValidationException::class.java).isThrownBy {
45+
assertThat(proxy.validName("name")).isEqualTo("name")
46+
assertThatExceptionOfType(ValidationException::class.java).isThrownBy {
4647
proxy.validName("")
4748
}
4849
}
@@ -55,8 +56,8 @@ class KotlinMethodValidationTests {
5556
validator.afterPropertiesSet()
5657
proxyFactory.addAdvice(MethodValidationInterceptor(validator as Validator))
5758
val proxy = proxyFactory.getProxy() as MyValidCoroutinesBean
58-
Assertions.assertThat(proxy.validName("name")).isEqualTo("name")
59-
Assertions.assertThatExceptionOfType(ValidationException::class.java).isThrownBy {
59+
assertThat(proxy.validName("name")).isEqualTo("name")
60+
assertThatExceptionOfType(ValidationException::class.java).isThrownBy {
6061
runBlocking {
6162
proxy.validName("")
6263
}

spring-core/src/main/java/org/springframework/cglib/core/TinyBitSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
@Deprecated
1919
public class TinyBitSet {
20-
private static int[] T = new int[256];
20+
private static final int[] T = new int[256];
2121
private int value = 0;
2222

2323
private static int gcount(int x) {

spring-core/src/main/java/org/springframework/core/annotation/RepeatableContainers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private static class StandardRepeatableContainers extends RepeatableContainers {
145145

146146
private static final Object NONE = new Object();
147147

148-
private static StandardRepeatableContainers INSTANCE = new StandardRepeatableContainers();
148+
private static final StandardRepeatableContainers INSTANCE = new StandardRepeatableContainers();
149149

150150
StandardRepeatableContainers() {
151151
super(null);
@@ -270,7 +270,7 @@ public int hashCode() {
270270
*/
271271
private static class NoRepeatableContainers extends RepeatableContainers {
272272

273-
private static NoRepeatableContainers INSTANCE = new NoRepeatableContainers();
273+
private static final NoRepeatableContainers INSTANCE = new NoRepeatableContainers();
274274

275275
NoRepeatableContainers() {
276276
super(null);

spring-core/src/main/java/org/springframework/core/codec/ResourceDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
public class ResourceDecoder extends AbstractDataBufferDecoder<Resource> {
4343

4444
/** Name of hint with a filename for the resource(e.g. from "Content-Disposition" HTTP header). */
45-
public static String FILENAME_HINT = ResourceDecoder.class.getName() + ".filename";
45+
public static final String FILENAME_HINT = ResourceDecoder.class.getName() + ".filename";
4646

4747

4848
public ResourceDecoder() {

spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,9 @@ private Resource findResource(ModuleReader moduleReader, String name) {
897897
}
898898

899899
/**
900-
* If it's a "file:" URI, use FileSystemResource to avoid duplicates
901-
* for the same path discovered via class-path scanning.
902-
*/
900+
* If it's a "file:" URI, use FileSystemResource to avoid duplicates
901+
* for the same path discovered via class-path scanning.
902+
*/
903903
private Resource convertModuleSystemURI(URI uri) {
904904
return (ResourceUtils.URL_PROTOCOL_FILE.equals(uri.getScheme()) ?
905905
new FileSystemResource(uri.getPath()) : UrlResource.from(uri));

spring-core/src/main/kotlin/org/springframework/aot/hint/TypeHintExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.aot.hint
1818

1919
/**
20-
* Extension for [TypeHint.Builder.onReachableType] providing a `onReachableType<Foo>())`
20+
* Extension for [TypeHint.Builder.onReachableType] providing a `onReachableType<Foo>()`
2121
* variant.
2222
*
2323
* @author Sebastien Deleuze

spring-core/src/test/kotlin/org/springframework/aot/hint/ResourceHintsExtensionsTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ResourceHintsExtensionsTests {
3232
private val resourceHints = mockk<ResourceHints>()
3333

3434
@Test
35-
fun `registerType extension with MemberCategory`() {
35+
fun `registerType extension`() {
3636
every { resourceHints.registerType(any<Class<String>>()) } returns resourceHints
3737
resourceHints.registerType<String>()
3838
verify { resourceHints.registerType(String::class.java) }

spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerUnitTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import io.r2dbc.spi.R2dbcBadGrammarException;
2626
import io.r2dbc.spi.R2dbcTimeoutException;
2727
import io.r2dbc.spi.Statement;
28-
import org.assertj.core.api.Assertions;
2928
import org.junit.jupiter.api.BeforeEach;
3029
import org.junit.jupiter.api.Test;
3130
import org.mockito.ArgumentCaptor;
@@ -345,7 +344,7 @@ void testConnectionReleasedWhenRollbackFails() {
345344
.doOnNext(connection -> {
346345
throw new IllegalStateException("Intentional error to trigger rollback");
347346
}).then()).as(StepVerifier::create)
348-
.verifyErrorSatisfies(e -> Assertions.assertThat(e)
347+
.verifyErrorSatisfies(e -> assertThat(e)
349348
.isInstanceOf(BadSqlGrammarException.class)
350349
.hasCause(new R2dbcBadGrammarException("Rollback should fail"))
351350
);

0 commit comments

Comments
 (0)