add some Javadoc, fix warning, and remove some minor junk

This commit is contained in:
Gavin King 2022-02-02 22:11:25 +01:00
parent c41c5c7472
commit 11f784e23b
21 changed files with 29 additions and 38 deletions

View File

@ -17,7 +17,7 @@ package org.hibernate.boot;
* @author Steve Ebersole
*/
public class CacheRegionDefinition {
public static enum CacheRegionType {
public enum CacheRegionType {
ENTITY,
COLLECTION,
QUERY

View File

@ -9,6 +9,8 @@ package org.hibernate.boot;
import org.hibernate.boot.jaxb.Origin;
/**
* Indicates a problem parsing the mapping document at a given {@link Origin}.
*
* @author Brett Meyer
*/
public class InvalidMappingException extends org.hibernate.InvalidMappingException {

View File

@ -9,6 +9,8 @@ package org.hibernate.boot;
import org.hibernate.boot.jaxb.Origin;
/**
* Indicates that a mapping document could not be found at a given {@link Origin}.
*
* @author Steve Ebersole
*/
public class MappingNotFoundException extends MappingException {

View File

@ -10,7 +10,7 @@ import org.hibernate.HibernateException;
import org.hibernate.cfg.AvailableSettings;
/**
* Defines the possible values for "hbm2ddl_auto"
* Defines the possible values for {@value AvailableSettings#HBM2DDL_AUTO}.
*
* @author Steve Ebersole
*/

View File

@ -31,7 +31,6 @@ import org.hibernate.resource.jdbc.spi.StatementInspector;
*
* @since 5.0
*/
@SuppressWarnings("UnusedReturnValue")
public interface SessionFactoryBuilder {
/**
* Specifies a Bean Validation {@link jakarta.validation.ValidatorFactory}.

View File

@ -19,7 +19,6 @@ public class UnsupportedOrmXsdVersionException extends MappingException {
this.requestedVersion = requestedVersion;
}
@SuppressWarnings("UnusedDeclaration")
public String getRequestedVersion() {
return requestedVersion;
}

View File

@ -34,8 +34,8 @@ public class ConfigLoader {
private final BootstrapServiceRegistry bootstrapServiceRegistry;
private ValueHolder<JaxbCfgProcessor> jaxbProcessorHolder = new ValueHolder<>(
new ValueHolder.DeferredInitializer<JaxbCfgProcessor>() {
private final ValueHolder<JaxbCfgProcessor> jaxbProcessorHolder = new ValueHolder<>(
new ValueHolder.DeferredInitializer<>() {
@Override
public JaxbCfgProcessor initialize() {
return new JaxbCfgProcessor( bootstrapServiceRegistry.getService( ClassLoaderService.class ) );

View File

@ -87,14 +87,12 @@ public class JaxbCfgProcessor {
return staxFactory;
}
@SuppressWarnings( { "UnnecessaryLocalVariable" })
private XMLInputFactory buildStaxFactory() {
XMLInputFactory staxFactory = XMLInputFactory.newInstance();
staxFactory.setXMLResolver( xmlResourceResolver );
return staxFactory;
}
@SuppressWarnings( { "unchecked" })
private JaxbCfgHibernateConfiguration unmarshal(XMLEventReader staxEventReader, final Origin origin) {
XMLEvent event;
try {
@ -165,10 +163,7 @@ public class JaxbCfgProcessor {
SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
return schemaFactory.newSchema( source );
}
catch ( SAXException e ) {
throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
}
catch ( IOException e ) {
catch ( SAXException | IOException e ) {
throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
}
finally {

View File

@ -19,7 +19,7 @@ import org.hibernate.internal.util.config.ConfigurationException;
* @author Steve Ebersole
*/
public class MappingReference {
public static enum Type {
public enum Type {
RESOURCE,
CLASS,
FILE,

View File

@ -45,8 +45,6 @@ import org.hibernate.type.spi.TypeConfiguration;
import org.jboss.jandex.IndexView;
import org.jboss.logging.Logger;
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
/**
* @author Andrea Boriero
*/
@ -78,7 +76,7 @@ public class BootstrapContextImpl implements BootstrapContext {
private ArrayList<AuxiliaryDatabaseObject> auxiliaryDatabaseObjectList;
private HashMap<Class<?>, ConverterDescriptor> attributeConverterDescriptorMap;
private ArrayList<CacheRegionDefinition> cacheRegionDefinitions;
private ManagedTypeRepresentationResolver representationStrategySelector;
private final ManagedTypeRepresentationResolver representationStrategySelector;
public BootstrapContextImpl(
StandardServiceRegistry serviceRegistry,

View File

@ -105,7 +105,7 @@ public class IdGeneratorInterpreterImpl implements IdGeneratorStrategyInterprete
return IncrementGenerator.class.getName();
}
final Class javaType = context.getIdType();
final Class<?> javaType = context.getIdType();
if ( UUID.class.isAssignableFrom( javaType ) ) {
return UUIDGenerator.class.getName();
}

View File

@ -43,7 +43,7 @@ import static org.hibernate.procedure.spi.NamedCallableQueryMemento.ParameterMem
public class NamedProcedureCallDefinitionImpl implements NamedProcedureCallDefinition {
private final String registeredName;
private final String procedureName;
private final Class[] resultClasses;
private final Class<?>[] resultClasses;
private final String[] resultSetMappings;
private final ParameterDefinitions parameterDefinitions;
private final Map<String, Object> hints;
@ -205,7 +205,7 @@ public class NamedProcedureCallDefinitionImpl implements NamedProcedureCallDefin
private final Integer position;
private final String name;
private final ParameterMode parameterMode;
private final Class type;
private final Class<?> type;
static ParameterDefinition from(
ParameterStrategy parameterStrategy,
@ -234,7 +234,6 @@ public class NamedProcedureCallDefinitionImpl implements NamedProcedureCallDefin
this.type = annotation.type();
}
@SuppressWarnings("UnnecessaryUnboxing")
public ParameterMemento toMemento(SessionFactoryImplementor sessionFactory) {
// todo (6.0): figure out how to handle this
// final boolean initialPassNullSetting = explicitPassNullSetting != null

View File

@ -23,7 +23,6 @@ import org.hibernate.service.spi.ServiceRegistryImplementor;
*
* @author Steve Ebersole
*/
@SuppressWarnings("deprecation")
public class DialectResolverInitiator implements StandardServiceInitiator<DialectResolver> {
/**
* Singleton access
@ -55,9 +54,8 @@ public class DialectResolverInitiator implements StandardServiceInitiator<Dialec
if ( StringHelper.isNotEmpty( resolverImplNames ) ) {
for ( String resolverImplName : StringHelper.split( ", \n\r\f\t", resolverImplNames ) ) {
try {
resolverSet.addResolver(
(DialectResolver) classLoaderService.classForName( resolverImplName ).newInstance()
);
DialectResolver dialectResolver = (DialectResolver) classLoaderService.classForName(resolverImplName).newInstance();
resolverSet.addResolver( dialectResolver );
}
catch (HibernateException e) {
throw e;

View File

@ -27,7 +27,7 @@ import org.hibernate.internal.CoreMessageLogger;
public class DialectResolverSet implements DialectResolver {
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( DialectResolverSet.class );
private List<DialectResolver> resolvers;
private final List<DialectResolver> resolvers;
public DialectResolverSet() {
this( new ArrayList<>() );

View File

@ -21,7 +21,7 @@ public class BasicDialectResolver implements DialectResolver {
private final int majorVersionToMatch;
private final int minorVersionToMatch;
private final Class dialectClass;
private final Class<?> dialectClass;
/**
* Constructs a BasicDialectResolver

View File

@ -12,7 +12,7 @@ import java.util.Iterator;
* @author Gavin King
*/
public final class SingletonIterator<T> implements Iterator<T> {
private T value;
private final T value;
private boolean hasNext = true;
public boolean hasNext() {

View File

@ -34,14 +34,14 @@ public final class StandardStack<T> implements Stack<T> {
@Override
public void push(T newCurrent) {
Object toStore = newCurrent;
T toStore = newCurrent;
if ( newCurrent == null ) {
toStore = NULL_TOKEN;
toStore = (T) NULL_TOKEN;
}
stackInstanceExpected().addFirst( toStore );
}
private Deque stackInstanceExpected() {
private Deque<T> stackInstanceExpected() {
if ( internalStack == null ) {
//"7" picked to use 8, but skipping the odd initialCapacity method
internalStack = new ArrayDeque<>( 7 );
@ -108,9 +108,8 @@ public final class StandardStack<T> implements Stack<T> {
if ( internalStack == null ) {
return null;
}
final Iterator<T> iterator = internalStack.iterator();
while ( iterator.hasNext() ) {
final X result = function.apply( iterator.next() );
for (T t : internalStack) {
final X result = function.apply(t);
if (result != null) {
return result;
}

View File

@ -23,7 +23,7 @@ public class ComparableComparator<T extends Comparable> implements Comparator<T>
return INSTANCE;
}
@SuppressWarnings({ "unchecked" })
@SuppressWarnings("unchecked")
public int compare(Comparable one, Comparable another) {
return one.compareTo( another );
}

View File

@ -87,7 +87,7 @@ public class DTDEntityResolver implements EntityResolver, Serializable {
InputStream dtdStream = resolveInHibernateNamespace( path );
if ( dtdStream == null ) {
LOG.debugf( "Unable to locate [%s] on classpath", systemId );
if ( systemId.substring( namespace.length() ).indexOf( "2.0" ) > -1 ) {
if ( systemId.substring( namespace.length() ).contains("2.0") ) {
LOG.usingOldDtd();
}
}

View File

@ -15,7 +15,7 @@ package org.hibernate.tool.schema;
public enum Action {
/**
* No action will be performed. Valid in JPA; compatible with Hibernate's
* hbm2ddl action of the same name..
* hbm2ddl action of the same name.
*/
NONE( "none" ),
/**

View File

@ -232,7 +232,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
javaTypeRegistry.resolveDescriptor(
basicType.getJavaType(),
() -> basicType.getJavaTypeDescriptor()
basicType::getJavaTypeDescriptor
);
jdbcToHibernateTypeContributionMap.computeIfAbsent(