Remove java.sql dependency from ReflectionUtils/TransactionDefinition
Fixes gh-21996
This commit is contained in:
parent
d3b5ba7a36
commit
80385ced4c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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 java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -46,15 +45,6 @@ import org.springframework.lang.Nullable;
|
|||
*/
|
||||
public abstract class ReflectionUtils {
|
||||
|
||||
/**
|
||||
* Pre-built MethodFilter that matches all non-bridge methods.
|
||||
* @since 3.0
|
||||
* @deprecated as of 5.0.11, in favor of a custom {@link MethodFilter}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final MethodFilter NON_BRIDGED_METHODS =
|
||||
(method -> !method.isBridge());
|
||||
|
||||
/**
|
||||
* Pre-built MethodFilter that matches all non-bridge non-synthetic methods
|
||||
* which are not declared on {@code java.lang.Object}.
|
||||
|
|
@ -251,52 +241,6 @@ public abstract class ReflectionUtils {
|
|||
throw new IllegalStateException("Should never get here");
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the specified JDBC API {@link Method} against the supplied target
|
||||
* object with no arguments.
|
||||
* @param method the method to invoke
|
||||
* @param target the target object to invoke the method on
|
||||
* @return the invocation result, if any
|
||||
* @throws SQLException the JDBC API SQLException to rethrow (if any)
|
||||
* @see #invokeJdbcMethod(java.lang.reflect.Method, Object, Object[])
|
||||
* @deprecated as of 5.0.11, in favor of custom SQLException handling
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public static Object invokeJdbcMethod(Method method, @Nullable Object target) throws SQLException {
|
||||
return invokeJdbcMethod(method, target, new Object[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the specified JDBC API {@link Method} against the supplied target
|
||||
* object with the supplied arguments.
|
||||
* @param method the method to invoke
|
||||
* @param target the target object to invoke the method on
|
||||
* @param args the invocation arguments (may be {@code null})
|
||||
* @return the invocation result, if any
|
||||
* @throws SQLException the JDBC API SQLException to rethrow (if any)
|
||||
* @see #invokeMethod(java.lang.reflect.Method, Object, Object[])
|
||||
* @deprecated as of 5.0.11, in favor of custom SQLException handling
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public static Object invokeJdbcMethod(Method method, @Nullable Object target, @Nullable Object... args)
|
||||
throws SQLException {
|
||||
try {
|
||||
return method.invoke(target, args);
|
||||
}
|
||||
catch (IllegalAccessException ex) {
|
||||
handleReflectionException(ex);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
if (ex.getTargetException() instanceof SQLException) {
|
||||
throw (SQLException) ex.getTargetException();
|
||||
}
|
||||
handleInvocationTargetException(ex);
|
||||
}
|
||||
throw new IllegalStateException("Should never get here");
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the given reflection exception. Should only be called if no
|
||||
* checked exception is expected to be thrown by the target method.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.transaction;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
|
|
@ -150,7 +148,7 @@ public interface TransactionDefinition {
|
|||
* retrieved an invalid row.
|
||||
* @see java.sql.Connection#TRANSACTION_READ_UNCOMMITTED
|
||||
*/
|
||||
int ISOLATION_READ_UNCOMMITTED = Connection.TRANSACTION_READ_UNCOMMITTED;
|
||||
int ISOLATION_READ_UNCOMMITTED = 1; // same as java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
|
||||
|
||||
/**
|
||||
* Indicates that dirty reads are prevented; non-repeatable reads and
|
||||
|
|
@ -159,7 +157,7 @@ public interface TransactionDefinition {
|
|||
* with uncommitted changes in it.
|
||||
* @see java.sql.Connection#TRANSACTION_READ_COMMITTED
|
||||
*/
|
||||
int ISOLATION_READ_COMMITTED = Connection.TRANSACTION_READ_COMMITTED;
|
||||
int ISOLATION_READ_COMMITTED = 2; // same as java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
||||
|
||||
/**
|
||||
* Indicates that dirty reads and non-repeatable reads are prevented;
|
||||
|
|
@ -170,7 +168,7 @@ public interface TransactionDefinition {
|
|||
* getting different values the second time (a "non-repeatable read").
|
||||
* @see java.sql.Connection#TRANSACTION_REPEATABLE_READ
|
||||
*/
|
||||
int ISOLATION_REPEATABLE_READ = Connection.TRANSACTION_REPEATABLE_READ;
|
||||
int ISOLATION_REPEATABLE_READ = 4; // same as java.sql.Connection.TRANSACTION_REPEATABLE_READ;
|
||||
|
||||
/**
|
||||
* Indicates that dirty reads, non-repeatable reads and phantom reads
|
||||
|
|
@ -183,7 +181,7 @@ public interface TransactionDefinition {
|
|||
* in the second read.
|
||||
* @see java.sql.Connection#TRANSACTION_SERIALIZABLE
|
||||
*/
|
||||
int ISOLATION_SERIALIZABLE = Connection.TRANSACTION_SERIALIZABLE;
|
||||
int ISOLATION_SERIALIZABLE = 8; // same as java.sql.Connection.TRANSACTION_SERIALIZABLE;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue