From 27b227113013ab29416fd73708c1fa6a5d00c20a Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Fri, 21 Jan 2022 15:15:41 +0100 Subject: [PATCH] Some deprecation removals (#4681) * Remove deprecations in org.hibernate.action.internal Signed-off-by: Jan Schatteman * Remove deprecated org.hibernate.lob.ReaderInputStream Signed-off-by: Jan Schatteman * Remove deprecated org.hibernate.tool.schema.extract.spi.SequenceInformation.getIncrementSize() Signed-off-by: Jan Schatteman * Update hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaValidator.java Co-authored-by: Christian Beikov Co-authored-by: Christian Beikov --- .../action/internal/CollectionAction.java | 16 ----------- .../action/internal/EntityAction.java | 13 --------- .../internal/EntityIdentityInsertAction.java | 13 --------- .../org/hibernate/lob/ReaderInputStream.java | 28 ------------------- .../extract/spi/SequenceInformation.java | 13 --------- .../internal/AbstractSchemaValidator.java | 6 ++-- 6 files changed, 3 insertions(+), 86 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/lob/ReaderInputStream.java diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionAction.java index f3294a620c..82f9d3f6c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionAction.java @@ -16,10 +16,7 @@ import org.hibernate.cache.spi.access.CollectionDataAccess; import org.hibernate.cache.spi.access.SoftLock; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.service.spi.EventListenerGroup; -import org.hibernate.event.service.spi.EventListenerRegistry; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.EventType; import org.hibernate.internal.FastSessionServices; import org.hibernate.internal.util.StringHelper; import org.hibernate.persister.collection.CollectionPersister; @@ -185,19 +182,6 @@ public abstract class CollectionAction implements Executable, Serializable, Comp } } - /** - * @deprecated This will be removed as it's not very efficient. If you need access to EventListenerGroup(s), - * use the direct references from {@link #getFastSessionServices()}. - */ - @Deprecated - protected EventListenerGroup listenerGroup(EventType eventType) { - return getSession() - .getFactory() - .getServiceRegistry() - .getService( EventListenerRegistry.class ) - .getEventListenerGroup( eventType ); - } - protected EventSource eventSource() { return (EventSource) getSession(); } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityAction.java index 0f30ce93cb..1374399bac 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityAction.java @@ -187,19 +187,6 @@ public abstract class EntityAction } } - /** - * @deprecated This will be removed as it's not very efficient. If you need access to EventListenerGroup(s), - * use the direct references from {@link #getFastSessionServices()}. - */ - @Deprecated - protected EventListenerGroup listenerGroup(EventType eventType) { - return getSession() - .getFactory() - .getServiceRegistry() - .getService( EventListenerRegistry.class ) - .getEventListenerGroup( eventType ); - } - protected EventSource eventSource() { return (EventSource) getSession(); } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java index f6816c9307..e32306a998 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java @@ -201,19 +201,6 @@ public class EntityIdentityInsertAction extends AbstractEntityInsertAction { this.generatedId = generatedId; } - /** - * Access to the delayed entity key - * - * @return The delayed entity key - * - * @deprecated No Hibernate code currently uses this method - */ - @Deprecated - @SuppressWarnings("UnusedDeclaration") - public EntityKey getDelayedEntityKey() { - return delayedEntityKey; - } - @Override public boolean isEarlyInsert() { return !isDelayed; diff --git a/hibernate-core/src/main/java/org/hibernate/lob/ReaderInputStream.java b/hibernate-core/src/main/java/org/hibernate/lob/ReaderInputStream.java deleted file mode 100644 index 7ad72ef3c9..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/lob/ReaderInputStream.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.lob; - -import java.io.IOException; -import java.io.Reader; - -/** - * Exposes a {@link Reader} as an {@link java.io.InputStream}. - * - * @deprecated Should not be used anymore. - */ -@Deprecated -public class ReaderInputStream extends org.hibernate.engine.jdbc.ReaderInputStream { - - public ReaderInputStream(Reader reader) { - super(reader); - } - - public int read() throws IOException { - return super.read(); - } - -} diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformation.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformation.java index 355a3ead6c..49ddb5d8f3 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformation.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformation.java @@ -22,19 +22,6 @@ public interface SequenceInformation { */ QualifiedSequenceName getSequenceName(); - /** - * Retrieve the extracted increment-size defined for the sequence. - * - * @return The extracted increment size; use a negative number to indicate the increment could not be extracted. - * - * @deprecated use {@link #getIncrementValue()} instead. - */ - @Deprecated - default int getIncrementSize() { - Long incrementSize = getIncrementValue(); - return incrementSize != null ? incrementSize.intValue() : -1; - } - /** * Retrieve the extracted start value defined for the sequence. * diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaValidator.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaValidator.java index db3897f084..4ed754e66f 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaValidator.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaValidator.java @@ -187,13 +187,13 @@ public abstract class AbstractSchemaValidator implements SchemaValidator { ); } - if ( sequenceInformation.getIncrementSize() > 0 - && sequence.getIncrementSize() != sequenceInformation.getIncrementSize() ) { + if ( sequenceInformation.getIncrementValue() != null && sequenceInformation.getIncrementValue() > 0 + && sequence.getIncrementSize() != sequenceInformation.getIncrementValue() ) { throw new SchemaManagementException( String.format( "Schema-validation: sequence [%s] defined inconsistent increment-size; found [%s] but expecting [%s]", sequence.getName(), - sequenceInformation.getIncrementSize(), + sequenceInformation.getIncrementValue(), sequence.getIncrementSize() ) );