HHH-16515 - Add o.h.jdbc to nullness checking

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-07-12 23:16:13 +02:00 committed by Christian Beikov
parent 2e73795e4b
commit ad36a76968
4 changed files with 10 additions and 5 deletions

View File

@ -544,7 +544,7 @@ checkerFramework {
extraJavacArgs = [
'-AsuppressWarnings=initialization',
// stubs is passed directly through options.compilerArgumentProviders
'-AonlyDefs=^org\\.hibernate\\.(exception|integrator|jpamodelgen|service|spi|pretty|stat|engine\\.(config|jndi|profile|transaction)|(action|context|bytecode)\\.spi)\\.'
'-AonlyDefs=^org\\.hibernate\\.(jdbc|exception|integrator|jpamodelgen|service|spi|pretty|stat|engine\\.(config|jndi|profile|transaction)|(action|context|bytecode)\\.spi)\\.'
]
}

View File

@ -7,6 +7,7 @@
package org.hibernate;
import jakarta.persistence.PersistenceException;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* The base type for exceptions thrown by Hibernate.
@ -31,7 +32,7 @@ public class HibernateException extends PersistenceException {
*
* @param cause The underlying cause.
*/
public HibernateException(Throwable cause) {
public HibernateException(@Nullable Throwable cause) {
super( cause );
}
@ -41,7 +42,7 @@ public class HibernateException extends PersistenceException {
* @param message The message explaining the reason for the exception.
* @param cause The underlying cause.
*/
public HibernateException(String message, Throwable cause) {
public HibernateException(String message, @Nullable Throwable cause) {
super( message, cause );
}
}

View File

@ -7,6 +7,8 @@
package org.hibernate.jdbc;
import org.hibernate.HibernateException;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Indicates a failed batch entry (-3 return).
*
@ -17,7 +19,7 @@ public class BatchFailedException extends HibernateException {
super( s );
}
public BatchFailedException(String string, Throwable root) {
public BatchFailedException(String string, @Nullable Throwable root) {
super( string, root );
}
}

View File

@ -9,6 +9,8 @@ package org.hibernate.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* A visitor used for executing a discrete piece of work encapsulated in a
* {@link Work} or {@link ReturningWork} instance.
@ -33,7 +35,7 @@ public class WorkExecutor<T> {
* @throws SQLException Thrown during execution of the underlying JDBC interaction.
* @throws org.hibernate.HibernateException Generally indicates a wrapped SQLException.
*/
public T executeWork(Work work, Connection connection) throws SQLException {
public @Nullable T executeWork(Work work, Connection connection) throws SQLException {
work.execute( connection );
return null;
}