Skip to content

Commit 80385ce

Browse files
committed
Remove java.sql dependency from ReflectionUtils/TransactionDefinition
Fixes gh-21996
1 parent d3b5ba7 commit 80385ce

File tree

2 files changed

+6
-64
lines changed

2 files changed

+6
-64
lines changed

spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -22,7 +22,6 @@
2222
import java.lang.reflect.Method;
2323
import java.lang.reflect.Modifier;
2424
import java.lang.reflect.UndeclaredThrowableException;
25-
import java.sql.SQLException;
2625
import java.util.ArrayList;
2726
import java.util.Arrays;
2827
import java.util.List;
@@ -46,15 +45,6 @@
4645
*/
4746
public abstract class ReflectionUtils {
4847

49-
/**
50-
* Pre-built MethodFilter that matches all non-bridge methods.
51-
* @since 3.0
52-
* @deprecated as of 5.0.11, in favor of a custom {@link MethodFilter}
53-
*/
54-
@Deprecated
55-
public static final MethodFilter NON_BRIDGED_METHODS =
56-
(method -> !method.isBridge());
57-
5848
/**
5949
* Pre-built MethodFilter that matches all non-bridge non-synthetic methods
6050
* which are not declared on {@code java.lang.Object}.
@@ -251,52 +241,6 @@ public static Object invokeMethod(Method method, @Nullable Object target, @Nulla
251241
throw new IllegalStateException("Should never get here");
252242
}
253243

254-
/**
255-
* Invoke the specified JDBC API {@link Method} against the supplied target
256-
* object with no arguments.
257-
* @param method the method to invoke
258-
* @param target the target object to invoke the method on
259-
* @return the invocation result, if any
260-
* @throws SQLException the JDBC API SQLException to rethrow (if any)
261-
* @see #invokeJdbcMethod(java.lang.reflect.Method, Object, Object[])
262-
* @deprecated as of 5.0.11, in favor of custom SQLException handling
263-
*/
264-
@Deprecated
265-
@Nullable
266-
public static Object invokeJdbcMethod(Method method, @Nullable Object target) throws SQLException {
267-
return invokeJdbcMethod(method, target, new Object[0]);
268-
}
269-
270-
/**
271-
* Invoke the specified JDBC API {@link Method} against the supplied target
272-
* object with the supplied arguments.
273-
* @param method the method to invoke
274-
* @param target the target object to invoke the method on
275-
* @param args the invocation arguments (may be {@code null})
276-
* @return the invocation result, if any
277-
* @throws SQLException the JDBC API SQLException to rethrow (if any)
278-
* @see #invokeMethod(java.lang.reflect.Method, Object, Object[])
279-
* @deprecated as of 5.0.11, in favor of custom SQLException handling
280-
*/
281-
@Deprecated
282-
@Nullable
283-
public static Object invokeJdbcMethod(Method method, @Nullable Object target, @Nullable Object... args)
284-
throws SQLException {
285-
try {
286-
return method.invoke(target, args);
287-
}
288-
catch (IllegalAccessException ex) {
289-
handleReflectionException(ex);
290-
}
291-
catch (InvocationTargetException ex) {
292-
if (ex.getTargetException() instanceof SQLException) {
293-
throw (SQLException) ex.getTargetException();
294-
}
295-
handleInvocationTargetException(ex);
296-
}
297-
throw new IllegalStateException("Should never get here");
298-
}
299-
300244
/**
301245
* Handle the given reflection exception. Should only be called if no
302246
* checked exception is expected to be thrown by the target method.

spring-tx/src/main/java/org/springframework/transaction/TransactionDefinition.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.transaction;
1818

19-
import java.sql.Connection;
20-
2119
import org.springframework.lang.Nullable;
2220

2321
/**
@@ -150,7 +148,7 @@ public interface TransactionDefinition {
150148
* retrieved an invalid row.
151149
* @see java.sql.Connection#TRANSACTION_READ_UNCOMMITTED
152150
*/
153-
int ISOLATION_READ_UNCOMMITTED = Connection.TRANSACTION_READ_UNCOMMITTED;
151+
int ISOLATION_READ_UNCOMMITTED = 1; // same as java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
154152

155153
/**
156154
* Indicates that dirty reads are prevented; non-repeatable reads and
@@ -159,7 +157,7 @@ public interface TransactionDefinition {
159157
* with uncommitted changes in it.
160158
* @see java.sql.Connection#TRANSACTION_READ_COMMITTED
161159
*/
162-
int ISOLATION_READ_COMMITTED = Connection.TRANSACTION_READ_COMMITTED;
160+
int ISOLATION_READ_COMMITTED = 2; // same as java.sql.Connection.TRANSACTION_READ_COMMITTED;
163161

164162
/**
165163
* Indicates that dirty reads and non-repeatable reads are prevented;
@@ -170,7 +168,7 @@ public interface TransactionDefinition {
170168
* getting different values the second time (a "non-repeatable read").
171169
* @see java.sql.Connection#TRANSACTION_REPEATABLE_READ
172170
*/
173-
int ISOLATION_REPEATABLE_READ = Connection.TRANSACTION_REPEATABLE_READ;
171+
int ISOLATION_REPEATABLE_READ = 4; // same as java.sql.Connection.TRANSACTION_REPEATABLE_READ;
174172

175173
/**
176174
* Indicates that dirty reads, non-repeatable reads and phantom reads
@@ -183,7 +181,7 @@ public interface TransactionDefinition {
183181
* in the second read.
184182
* @see java.sql.Connection#TRANSACTION_SERIALIZABLE
185183
*/
186-
int ISOLATION_SERIALIZABLE = Connection.TRANSACTION_SERIALIZABLE;
184+
int ISOLATION_SERIALIZABLE = 8; // same as java.sql.Connection.TRANSACTION_SERIALIZABLE;
187185

188186

189187
/**

0 commit comments

Comments
 (0)