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.
*/
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
@ -45,7 +45,7 @@ public interface CustomEntityDirtinessStrategy {
*
* @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
@ -55,7 +55,7 @@ public interface CustomEntityDirtinessStrategy {
* @param persister The persister corresponding to the given entity
* @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
@ -67,7 +67,7 @@ public interface CustomEntityDirtinessStrategy {
* @param session The session from which this call originates.
* @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
@ -76,20 +76,20 @@ public interface CustomEntityDirtinessStrategy {
*
* @see CustomEntityDirtinessStrategy#findDirty
*/
public static interface DirtyCheckContext {
interface DirtyCheckContext {
/**
* 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}.
*
* @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.
*/
public static interface AttributeChecker {
interface AttributeChecker {
/**
* 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.
*/
public boolean isDirty(AttributeInformation attributeInformation);
boolean isDirty(AttributeInformation attributeInformation);
}
/**
* Provides {@link AttributeChecker} with meta information about the attributes being checked.
*/
@SuppressWarnings( {"UnusedDeclaration"})
public static interface AttributeInformation {
interface AttributeInformation {
/**
* Get a reference to the persister for the entity containing this attribute.
*
* @return The entity persister.
*/
public EntityPersister getContainingPersister();
EntityPersister getContainingPersister();
/**
* Many of Hibernate internals use arrays to define information about attributes. This value
@ -121,28 +120,28 @@ public interface CustomEntityDirtinessStrategy {
*
* @return The attribute index.
*/
public int getAttributeIndex();
int getAttributeIndex();
/**
* Get the name of this attribute.
*
* @return The attribute name
*/
public String getName();
String getName();
/**
* Get the mapping type of this attribute.
*
* @return The mapping type.
*/
public Type getType();
Type getType();
/**
* Get the current value of this attribute.
*
* @return The attributes current value
*/
public Object getCurrentValue();
Object getCurrentValue();
/**
* Get the loaded value of this attribute.
@ -152,8 +151,7 @@ public interface CustomEntityDirtinessStrategy {
*
* @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
* 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.
*/
public String getName();
String getName();
/**
* Get the filter definition containing additional information about the
@ -30,7 +30,7 @@ public interface Filter {
*
* @return The filter definition
*/
public FilterDefinition getFilterDefinition();
FilterDefinition getFilterDefinition();
/**

View File

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

View File

@ -26,7 +26,7 @@ public interface LobHelper {
*
* @return the created Blob
*/
public Blob createBlob(byte[] bytes);
Blob createBlob(byte[] bytes);
/**
* Create a new {@link Blob} from stream data.
@ -36,7 +36,7 @@ public interface LobHelper {
* @return the create Blob
*/
public Blob createBlob(InputStream stream, long length);
Blob createBlob(InputStream stream, long length);
/**
* Create a new {@link Clob} from content.
@ -45,7 +45,7 @@ public interface LobHelper {
*
* @return The created {@link Clob}
*/
public Clob createClob(String string);
Clob createClob(String string);
/**
* Create a new {@link Clob} from character reader.
@ -55,7 +55,7 @@ public interface LobHelper {
*
* @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.
@ -64,7 +64,7 @@ public interface LobHelper {
*
* @return The created {@link NClob}
*/
public NClob createNClob(String string);
NClob createNClob(String string);
/**
* Create a new {@link NClob} from character reader.
@ -74,5 +74,5 @@ public interface LobHelper {
*
* @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
FORCE( 15, "force" ),
/**
/*
* start of jakarta.persistence.LockModeType equivalent modes
*/
@ -115,7 +115,7 @@ public enum LockMode {
private final int level;
private final String externalForm;
private LockMode(int level, String externalForm) {
LockMode(int level, String externalForm) {
this.level = level;
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
* given class or interface, accounting for implicit/explicit polymorphism settings
* and excluding mapped subclasses/joined-subclasses of other classes in the result.
* @throws MappingException
*/
String[] getImplementors(String entityName);

View File

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

View File

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

View File

@ -20,7 +20,10 @@ public enum ReplicationMode {
*/
EXCEPTION {
@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" );
}
},
@ -29,7 +32,10 @@ public enum ReplicationMode {
*/
IGNORE {
@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;
}
},
@ -38,7 +44,10 @@ public enum ReplicationMode {
*/
OVERWRITE {
@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;
}
},
@ -47,10 +56,14 @@ public enum ReplicationMode {
*/
LATEST_VERSION {
@Override
@SuppressWarnings("unchecked")
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, BasicType<Object> versionType) {
public boolean shouldOverwriteCurrentVersion(
Object entity,
Object currentVersion, Object newVersion,
BasicType<Object> versionType) {
// 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.
*/
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 ScrollMode(int level) {
ScrollMode(int level) {
this.resultSetType = level;
}

View File

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

View File

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

View File

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

View File

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