Skip to content

Commit fa95bf4

Browse files
committed
Apply "instanceof pattern matching" in remainder of spring-test module
See gh-30067
1 parent eea000d commit fa95bf4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-test/src/main/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -340,8 +340,8 @@ private DataSource getDataSourceFromTransactionManager(PlatformTransactionManage
340340
try {
341341
Method getDataSourceMethod = transactionManager.getClass().getMethod("getDataSource");
342342
Object obj = ReflectionUtils.invokeMethod(getDataSourceMethod, transactionManager);
343-
if (obj instanceof DataSource) {
344-
return (DataSource) obj;
343+
if (obj instanceof DataSource dataSource) {
344+
return dataSource;
345345
}
346346
}
347347
catch (Exception ex) {

0 commit comments

Comments
 (0)