squash warnings in the root package

This commit is contained in:
Gavin King 2022-01-23 01:03:06 +01:00
parent e3a59f883a
commit 121fd2d879
15 changed files with 86 additions and 74 deletions

View File

@ -33,7 +33,7 @@ public interface CustomEntityDirtinessStrategy {
* *
* @return {@code true} indicates the dirty check can be done; {@code false} indicates it cannot. * @return {@code true} indicates the dirty check can be done; {@code false} indicates it cannot.
*/ */
public boolean canDirtyCheck(Object entity, EntityPersister persister, Session session); boolean canDirtyCheck(Object entity, EntityPersister persister, Session session);
/** /**
* The callback used by Hibernate to determine if the given entity is dirty. Only called if the previous * The callback used by Hibernate to determine if the given entity is dirty. Only called if the previous
@ -45,7 +45,7 @@ public interface CustomEntityDirtinessStrategy {
* *
* @return {@code true} indicates the entity is dirty; {@code false} indicates the entity is not dirty. * @return {@code true} indicates the entity is dirty; {@code false} indicates the entity is not dirty.
*/ */
public boolean isDirty(Object entity, EntityPersister persister, Session session); boolean isDirty(Object entity, EntityPersister persister, Session session);
/** /**
* Callback used by Hibernate to signal that the entity dirty flag should be cleared. Generally this * Callback used by Hibernate to signal that the entity dirty flag should be cleared. Generally this
@ -55,7 +55,7 @@ public interface CustomEntityDirtinessStrategy {
* @param persister The persister corresponding to the given entity * @param persister The persister corresponding to the given entity
* @param session The session from which this call originates. * @param session The session from which this call originates.
*/ */
public void resetDirty(Object entity, EntityPersister persister, Session session); void resetDirty(Object entity, EntityPersister persister, Session session);
/** /**
* Callback used to hook into Hibernate algorithm for determination of which attributes have changed. Applications * Callback used to hook into Hibernate algorithm for determination of which attributes have changed. Applications
@ -67,7 +67,7 @@ public interface CustomEntityDirtinessStrategy {
* @param session The session from which this call originates. * @param session The session from which this call originates.
* @param dirtyCheckContext The callback context * @param dirtyCheckContext The callback context
*/ */
public void findDirty(Object entity, EntityPersister persister, Session session, DirtyCheckContext dirtyCheckContext); void findDirty(Object entity, EntityPersister persister, Session session, DirtyCheckContext dirtyCheckContext);
/** /**
* A callback to drive dirty checking. Handed to the {@link CustomEntityDirtinessStrategy#findDirty} method * A callback to drive dirty checking. Handed to the {@link CustomEntityDirtinessStrategy#findDirty} method
@ -76,20 +76,20 @@ public interface CustomEntityDirtinessStrategy {
* *
* @see CustomEntityDirtinessStrategy#findDirty * @see CustomEntityDirtinessStrategy#findDirty
*/ */
public static interface DirtyCheckContext { interface DirtyCheckContext {
/** /**
* The callback to indicate that dirty checking (the dirty attribute determination phase) should be handled * The callback to indicate that dirty checking (the dirty attribute determination phase) should be handled
* by the calling {@link CustomEntityDirtinessStrategy} using the given {@link AttributeChecker}. * by the calling {@link CustomEntityDirtinessStrategy} using the given {@link AttributeChecker}.
* *
* @param attributeChecker The delegate usable by the context for determining which attributes are dirty. * @param attributeChecker The delegate usable by the context for determining which attributes are dirty.
*/ */
public void doDirtyChecking(AttributeChecker attributeChecker); void doDirtyChecking(AttributeChecker attributeChecker);
} }
/** /**
* Responsible for identifying when attributes are dirty. * Responsible for identifying when attributes are dirty.
*/ */
public static interface AttributeChecker { interface AttributeChecker {
/** /**
* Do the attribute dirty check. * Do the attribute dirty check.
* *
@ -98,20 +98,19 @@ public interface CustomEntityDirtinessStrategy {
* *
* @return {@code true} indicates the attribute value has changed; {@code false} indicates it has not. * @return {@code true} indicates the attribute value has changed; {@code false} indicates it has not.
*/ */
public boolean isDirty(AttributeInformation attributeInformation); boolean isDirty(AttributeInformation attributeInformation);
} }
/** /**
* Provides {@link AttributeChecker} with meta information about the attributes being checked. * Provides {@link AttributeChecker} with meta information about the attributes being checked.
*/ */
@SuppressWarnings( {"UnusedDeclaration"}) interface AttributeInformation {
public static interface AttributeInformation {
/** /**
* Get a reference to the persister for the entity containing this attribute. * Get a reference to the persister for the entity containing this attribute.
* *
* @return The entity persister. * @return The entity persister.
*/ */
public EntityPersister getContainingPersister(); EntityPersister getContainingPersister();
/** /**
* Many of Hibernate internals use arrays to define information about attributes. This value * Many of Hibernate internals use arrays to define information about attributes. This value
@ -121,28 +120,28 @@ public interface CustomEntityDirtinessStrategy {
* *
* @return The attribute index. * @return The attribute index.
*/ */
public int getAttributeIndex(); int getAttributeIndex();
/** /**
* Get the name of this attribute. * Get the name of this attribute.
* *
* @return The attribute name * @return The attribute name
*/ */
public String getName(); String getName();
/** /**
* Get the mapping type of this attribute. * Get the mapping type of this attribute.
* *
* @return The mapping type. * @return The mapping type.
*/ */
public Type getType(); Type getType();
/** /**
* Get the current value of this attribute. * Get the current value of this attribute.
* *
* @return The attributes current value * @return The attributes current value
*/ */
public Object getCurrentValue(); Object getCurrentValue();
/** /**
* Get the loaded value of this attribute. * Get the loaded value of this attribute.
@ -152,8 +151,7 @@ public interface CustomEntityDirtinessStrategy {
* *
* @return The attributes loaded value * @return The attributes loaded value
*/ */
public Object getLoadedValue(); Object getLoadedValue();
} }
} }

View File

@ -20,5 +20,5 @@ public interface EntityNameResolver {
* @return The corresponding entity-name, or null if this impl does not know how to perform resolution * @return The corresponding entity-name, or null if this impl does not know how to perform resolution
* for the given entity instance. * for the given entity instance.
*/ */
public String resolveEntityName(Object entity); String resolveEntityName(Object entity);
} }

View File

@ -22,7 +22,7 @@ public interface Filter {
* *
* @return This filter's name. * @return This filter's name.
*/ */
public String getName(); String getName();
/** /**
* Get the filter definition containing additional information about the * Get the filter definition containing additional information about the
@ -30,7 +30,7 @@ public interface Filter {
* *
* @return The filter definition * @return The filter definition
*/ */
public FilterDefinition getFilterDefinition(); FilterDefinition getFilterDefinition();
/** /**

View File

@ -12,7 +12,7 @@ package org.hibernate;
* @author Gavin King * @author Gavin King
*/ */
public class InstantiationException extends HibernateException { public class InstantiationException extends HibernateException {
private final Class clazz; private final Class<?> clazz;
/** /**
* Constructs a InstantiationException. * Constructs a InstantiationException.
@ -21,7 +21,7 @@ public class InstantiationException extends HibernateException {
* @param clazz The Class we are attempting to instantiate * @param clazz The Class we are attempting to instantiate
* @param cause The underlying exception * @param cause The underlying exception
*/ */
public InstantiationException(String message, Class clazz, Throwable cause) { public InstantiationException(String message, Class<?> clazz, Throwable cause) {
super( message, cause ); super( message, cause );
this.clazz = clazz; this.clazz = clazz;
} }
@ -32,7 +32,7 @@ public class InstantiationException extends HibernateException {
* @param message A message explaining the exception condition * @param message A message explaining the exception condition
* @param clazz The Class we are attempting to instantiate * @param clazz The Class we are attempting to instantiate
*/ */
public InstantiationException(String message, Class clazz) { public InstantiationException(String message, Class<?> clazz) {
this( message, clazz, null ); this( message, clazz, null );
} }
@ -43,7 +43,7 @@ public class InstantiationException extends HibernateException {
* @param clazz The Class we are attempting to instantiate * @param clazz The Class we are attempting to instantiate
* @param cause The underlying exception * @param cause The underlying exception
*/ */
public InstantiationException(String message, Class clazz, Exception cause) { public InstantiationException(String message, Class<?> clazz, Exception cause) {
super( message, cause ); super( message, cause );
this.clazz = clazz; this.clazz = clazz;
} }
@ -56,7 +56,7 @@ public class InstantiationException extends HibernateException {
* @return The class we are unable to instantiate * @return The class we are unable to instantiate
*/ */
@Deprecated @Deprecated
public Class getPersistentClass() { public Class<?> getPersistentClass() {
return clazz; return clazz;
} }
@ -65,7 +65,7 @@ public class InstantiationException extends HibernateException {
* *
* @return The class we are unable to instantiate * @return The class we are unable to instantiate
*/ */
public Class getUninstantiatableClass() { public Class<?> getUninstantiatableClass() {
return clazz; return clazz;
} }

View File

@ -26,7 +26,7 @@ public interface LobHelper {
* *
* @return the created Blob * @return the created Blob
*/ */
public Blob createBlob(byte[] bytes); Blob createBlob(byte[] bytes);
/** /**
* Create a new {@link Blob} from stream data. * Create a new {@link Blob} from stream data.
@ -36,7 +36,7 @@ public interface LobHelper {
* @return the create Blob * @return the create Blob
*/ */
public Blob createBlob(InputStream stream, long length); Blob createBlob(InputStream stream, long length);
/** /**
* Create a new {@link Clob} from content. * Create a new {@link Clob} from content.
@ -45,7 +45,7 @@ public interface LobHelper {
* *
* @return The created {@link Clob} * @return The created {@link Clob}
*/ */
public Clob createClob(String string); Clob createClob(String string);
/** /**
* Create a new {@link Clob} from character reader. * Create a new {@link Clob} from character reader.
@ -55,7 +55,7 @@ public interface LobHelper {
* *
* @return The created {@link Clob} * @return The created {@link Clob}
*/ */
public Clob createClob(Reader reader, long length); Clob createClob(Reader reader, long length);
/** /**
* Create a new {@link NClob} from content. * Create a new {@link NClob} from content.
@ -64,7 +64,7 @@ public interface LobHelper {
* *
* @return The created {@link NClob} * @return The created {@link NClob}
*/ */
public NClob createNClob(String string); NClob createNClob(String string);
/** /**
* Create a new {@link NClob} from character reader. * Create a new {@link NClob} from character reader.
@ -74,5 +74,5 @@ public interface LobHelper {
* *
* @return The created {@link NClob} * @return The created {@link NClob}
*/ */
public NClob createNClob(Reader reader, long length); NClob createNClob(Reader reader, long length);
} }

View File

@ -79,7 +79,7 @@ public enum LockMode {
@Deprecated @Deprecated
FORCE( 15, "force" ), FORCE( 15, "force" ),
/** /*
* start of jakarta.persistence.LockModeType equivalent modes * start of jakarta.persistence.LockModeType equivalent modes
*/ */
@ -115,7 +115,7 @@ public enum LockMode {
private final int level; private final int level;
private final String externalForm; private final String externalForm;
private LockMode(int level, String externalForm) { LockMode(int level, String externalForm) {
this.level = level; this.level = level;
this.externalForm = externalForm; this.externalForm = externalForm;
} }

View File

@ -45,7 +45,6 @@ public interface Metamodel extends JpaMetamodel {
* @return the names of all persistent (mapped) classes that extend or implement the * @return the names of all persistent (mapped) classes that extend or implement the
* given class or interface, accounting for implicit/explicit polymorphism settings * given class or interface, accounting for implicit/explicit polymorphism settings
* and excluding mapped subclasses/joined-subclasses of other classes in the result. * and excluding mapped subclasses/joined-subclasses of other classes in the result.
* @throws MappingException
*/ */
String[] getImplementors(String entityName); String[] getImplementors(String entityName);

View File

@ -21,7 +21,7 @@ import org.hibernate.internal.util.StringHelper;
* @author Gavin King * @author Gavin King
*/ */
public class PropertyAccessException extends HibernateException { public class PropertyAccessException extends HibernateException {
private final Class persistentClass; private final Class<?> persistentClass;
private final String propertyName; private final String propertyName;
private final boolean wasSetter; private final boolean wasSetter;
@ -38,7 +38,7 @@ public class PropertyAccessException extends HibernateException {
Throwable cause, Throwable cause,
String message, String message,
boolean wasSetter, boolean wasSetter,
Class persistentClass, Class<?> persistentClass,
String propertyName) { String propertyName) {
super( message, cause ); super( message, cause );
this.persistentClass = persistentClass; this.persistentClass = persistentClass;
@ -46,7 +46,7 @@ public class PropertyAccessException extends HibernateException {
this.propertyName = propertyName; this.propertyName = propertyName;
} }
public Class getPersistentClass() { public Class<?> getPersistentClass() {
return persistentClass; return persistentClass;
} }

View File

@ -24,9 +24,9 @@ public class PropertySetterAccessException extends PropertyAccessException {
*/ */
public PropertySetterAccessException( public PropertySetterAccessException(
Throwable cause, Throwable cause,
Class persistentClass, Class<?> persistentClass,
String propertyName, String propertyName,
Class expectedType, Class<?> expectedType,
Object target, Object target,
Object value) { Object value) {
super( super(

View File

@ -20,7 +20,10 @@ public enum ReplicationMode {
*/ */
EXCEPTION { EXCEPTION {
@Override @Override
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, BasicType<Object> versionType) { public boolean shouldOverwriteCurrentVersion(
Object entity,
Object currentVersion, Object newVersion,
BasicType<Object> versionType) {
throw new AssertionFailure( "should not be called" ); throw new AssertionFailure( "should not be called" );
} }
}, },
@ -29,7 +32,10 @@ public enum ReplicationMode {
*/ */
IGNORE { IGNORE {
@Override @Override
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, BasicType<Object> versionType) { public boolean shouldOverwriteCurrentVersion(
Object entity,
Object currentVersion, Object newVersion,
BasicType<Object> versionType) {
return false; return false;
} }
}, },
@ -38,7 +44,10 @@ public enum ReplicationMode {
*/ */
OVERWRITE { OVERWRITE {
@Override @Override
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, BasicType<Object> versionType) { public boolean shouldOverwriteCurrentVersion(
Object entity,
Object currentVersion, Object newVersion,
BasicType<Object> versionType) {
return true; return true;
} }
}, },
@ -47,10 +56,14 @@ public enum ReplicationMode {
*/ */
LATEST_VERSION { LATEST_VERSION {
@Override @Override
@SuppressWarnings("unchecked") public boolean shouldOverwriteCurrentVersion(
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, BasicType<Object> versionType) { Object entity,
Object currentVersion, Object newVersion,
BasicType<Object> versionType) {
// always overwrite non-versioned data (because we don't know which is newer) // always overwrite non-versioned data (because we don't know which is newer)
return versionType == null || versionType.getJavaTypeDescriptor().getComparator().compare( currentVersion, newVersion ) <= 0; return versionType == null
|| versionType.getJavaTypeDescriptor().getComparator()
.compare( currentVersion, newVersion ) <= 0;
} }
}; };
@ -64,6 +77,9 @@ public enum ReplicationMode {
* *
* @return {@code true} indicates the data should be overwritten; {@code false} indicates it should not. * @return {@code true} indicates the data should be overwritten; {@code false} indicates it should not.
*/ */
public abstract boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, BasicType<Object> versionType); public abstract boolean shouldOverwriteCurrentVersion(
Object entity,
Object currentVersion, Object newVersion,
BasicType<Object> versionType);
} }

View File

@ -41,7 +41,7 @@ public enum ScrollMode {
private final int resultSetType; private final int resultSetType;
private ScrollMode(int level) { ScrollMode(int level) {
this.resultSetType = level; this.resultSetType = level;
} }

View File

@ -9,7 +9,6 @@ package org.hibernate;
import java.sql.Connection; import java.sql.Connection;
import java.util.TimeZone; import java.util.TimeZone;
import org.hibernate.query.Query;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector; import org.hibernate.resource.jdbc.spi.StatementInspector;
@ -18,7 +17,6 @@ import org.hibernate.resource.jdbc.spi.StatementInspector;
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings("UnusedReturnValue")
public interface SessionBuilder<T extends SessionBuilder> { public interface SessionBuilder<T extends SessionBuilder> {
/** /**
* Opens a session with the specified options. * Opens a session with the specified options.
@ -94,6 +92,7 @@ public interface SessionBuilder<T extends SessionBuilder> {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
@SuppressWarnings("UnusedReturnValue")
T autoClear(boolean autoClear); T autoClear(boolean autoClear);
/** /**

View File

@ -16,37 +16,37 @@ import java.io.Serializable;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface SessionEventListener extends Serializable { public interface SessionEventListener extends Serializable {
public void transactionCompletion(boolean successful); void transactionCompletion(boolean successful);
public void jdbcConnectionAcquisitionStart(); void jdbcConnectionAcquisitionStart();
public void jdbcConnectionAcquisitionEnd(); void jdbcConnectionAcquisitionEnd();
public void jdbcConnectionReleaseStart(); void jdbcConnectionReleaseStart();
public void jdbcConnectionReleaseEnd(); void jdbcConnectionReleaseEnd();
public void jdbcPrepareStatementStart(); void jdbcPrepareStatementStart();
public void jdbcPrepareStatementEnd(); void jdbcPrepareStatementEnd();
public void jdbcExecuteStatementStart(); void jdbcExecuteStatementStart();
public void jdbcExecuteStatementEnd(); void jdbcExecuteStatementEnd();
public void jdbcExecuteBatchStart(); void jdbcExecuteBatchStart();
public void jdbcExecuteBatchEnd(); void jdbcExecuteBatchEnd();
public void cachePutStart(); void cachePutStart();
public void cachePutEnd(); void cachePutEnd();
public void cacheGetStart(); void cacheGetStart();
public void cacheGetEnd(boolean hit); void cacheGetEnd(boolean hit);
public void flushStart(); void flushStart();
public void flushEnd(int numberOfEntities, int numberOfCollections); void flushEnd(int numberOfEntities, int numberOfCollections);
public void partialFlushStart(); void partialFlushStart();
public void partialFlushEnd(int numberOfEntities, int numberOfCollections); void partialFlushEnd(int numberOfEntities, int numberOfCollections);
public void dirtyCalculationStart(); void dirtyCalculationStart();
public void dirtyCalculationEnd(boolean dirty); void dirtyCalculationEnd(boolean dirty);
public void end(); void end();
} }

View File

@ -115,7 +115,7 @@ public interface SharedSessionBuilder<T extends SharedSessionBuilder> extends Se
@Override @Override
T autoClose(boolean autoClose); T autoClose(boolean autoClose);
@Override @Override @SuppressWarnings("unchecked")
default T flushBeforeCompletion(boolean flushBeforeCompletion) { default T flushBeforeCompletion(boolean flushBeforeCompletion) {
if ( flushBeforeCompletion ) { if ( flushBeforeCompletion ) {
flushMode( FlushMode.ALWAYS ); flushMode( FlushMode.ALWAYS );

View File

@ -26,5 +26,5 @@ public enum TimeZoneStorageStrategy {
/** /**
* Doesn't store the time zone, but instead normalizes to UTC. * Doesn't store the time zone, but instead normalizes to UTC.
*/ */
NORMALIZE; NORMALIZE
} }