Fix inconsistency between `isWrapperFor` and `unwrap` (#2243)

Closes GH-2237
pull/2238/head
Yanming Zhou 3 months ago committed by GitHub
parent 39385b943f
commit e58966bc09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,7 +19,7 @@ package com.zaxxer.hikari.pool;
import java.sql.CallableStatement;
/**
* This is the proxy class for java.sql.CallableStatement.
* This is the proxy class for {@link CallableStatement}.
*
* @author Brett Wooldridge
*/

@ -30,7 +30,7 @@ import java.util.concurrent.Executor;
import static com.zaxxer.hikari.SQLExceptionOverride.Override.DO_NOT_EVICT;
/**
* This is the proxy class for java.sql.Connection.
* This is the proxy class for {@link Connection}.
*
* @author Brett Wooldridge
*/

@ -5,6 +5,12 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* This is the proxy class for {@link DatabaseMetaData}.
*
* @author Brett Wooldridge
* @author Yanming Zhou
*/
public abstract class ProxyDatabaseMetaData implements DatabaseMetaData
{
protected final ProxyConnection connection;
@ -302,6 +308,13 @@ public abstract class ProxyDatabaseMetaData implements DatabaseMetaData
return ProxyFactory.getProxyResultSet(connection, (ProxyStatement) statement, resultSet);
}
/** {@inheritDoc} */
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException
{
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")

@ -21,7 +21,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
/**
* This is the proxy class for java.sql.PreparedStatement.
* This is the proxy class for {@link PreparedStatement}.
*
* @author Brett Wooldridge
*/

@ -21,9 +21,10 @@ import java.sql.SQLException;
import java.sql.Statement;
/**
* This is the proxy class for java.sql.ResultSet.
* This is the proxy class for {@link ResultSet}.
*
* @author Brett Wooldridge
* @author Yanming Zhou
*/
public abstract class ProxyResultSet implements ResultSet
{
@ -85,6 +86,13 @@ public abstract class ProxyResultSet implements ResultSet
delegate.deleteRow();
}
/** {@inheritDoc} */
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException
{
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")

@ -22,9 +22,10 @@ import java.sql.SQLException;
import java.sql.Statement;
/**
* This is the proxy class for java.sql.Statement.
* This is the proxy class for {@link Statement}.
*
* @author Brett Wooldridge
* @author Yanming Zhou
*/
public abstract class ProxyStatement implements Statement
{
@ -233,6 +234,13 @@ public abstract class ProxyStatement implements Statement
return proxyResultSet;
}
/** {@inheritDoc} */
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException
{
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")

Loading…
Cancel
Save