From f49535d39767c0e8b1fd110eebdc9b299b52e673 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 1 Jun 2023 15:50:11 +0100 Subject: [PATCH] Migrate type from Serializable[] to String[] --- .../action/internal/BulkOperationCleanupAction.java | 4 ++-- .../org/hibernate/action/internal/CollectionAction.java | 4 +--- .../java/org/hibernate/action/internal/EntityAction.java | 4 +--- .../main/java/org/hibernate/action/spi/Executable.java | 4 +--- .../main/java/org/hibernate/engine/spi/ActionQueue.java | 2 +- .../persister/collection/CollectionPersister.java | 3 +-- .../org/hibernate/persister/entity/EntityPersister.java | 2 +- .../persister/entity/JoinedSubclassEntityPersister.java | 3 +-- .../persister/entity/SingleTableEntityPersister.java | 3 +-- .../persister/entity/UnionSubclassEntityPersister.java | 2 +- .../test/cfg/persister/GoofyPersisterClassProvider.java | 8 ++++---- .../test/engine/action/NonSortedExecutableListTest.java | 4 ++-- .../orm/test/engine/action/SortedExecutableListTest.java | 4 ++-- .../jpa/ejb3configuration/PersisterClassProviderTest.java | 4 ++-- .../org/hibernate/orm/test/legacy/CustomPersister.java | 2 +- .../jpamodelgen/validation/MockCollectionPersister.java | 6 ++---- .../jpamodelgen/validation/MockEntityPersister.java | 4 ++-- 17 files changed, 26 insertions(+), 37 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/BulkOperationCleanupAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/BulkOperationCleanupAction.java index 7f4c085dbd..03008c4c7a 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/BulkOperationCleanupAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/BulkOperationCleanupAction.java @@ -46,7 +46,7 @@ import org.hibernate.sql.ast.tree.insert.InsertSelectStatement; */ public class BulkOperationCleanupAction implements Executable, Serializable { - private final Serializable[] affectedTableSpaces; + private final String[] affectedTableSpaces; private final Set entityCleanups = new HashSet<>(); private final Set collectionCleanups = new HashSet<>(); @@ -211,7 +211,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return affectedTableSpaces; } 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 3c1ba30737..c51d68bf22 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 @@ -6,8 +6,6 @@ */ package org.hibernate.action.internal; -import java.io.Serializable; - import org.hibernate.action.spi.AfterTransactionCompletionProcess; import org.hibernate.action.spi.BeforeTransactionCompletionProcess; import org.hibernate.cache.CacheException; @@ -101,7 +99,7 @@ public abstract class CollectionAction implements ComparableExecutable { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return persister.getCollectionSpaces(); } 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 203c0f31b3..0cc8c531f1 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 @@ -6,8 +6,6 @@ */ package org.hibernate.action.internal; -import java.io.Serializable; - import org.hibernate.AssertionFailure; import org.hibernate.action.spi.AfterTransactionCompletionProcess; import org.hibernate.action.spi.BeforeTransactionCompletionProcess; @@ -136,7 +134,7 @@ public abstract class EntityAction } @Override - public final Serializable[] getPropertySpaces() { + public final String[] getPropertySpaces() { return persister.getPropertySpaces(); } diff --git a/hibernate-core/src/main/java/org/hibernate/action/spi/Executable.java b/hibernate-core/src/main/java/org/hibernate/action/spi/Executable.java index 52ec4b40ca..1486033d5c 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/spi/Executable.java +++ b/hibernate-core/src/main/java/org/hibernate/action/spi/Executable.java @@ -6,8 +6,6 @@ */ package org.hibernate.action.spi; -import java.io.Serializable; - import org.hibernate.HibernateException; import org.hibernate.event.spi.EventSource; @@ -27,7 +25,7 @@ public interface Executable { * * @return The spaces affected by this action. */ - Serializable[] getPropertySpaces(); + String[] getPropertySpaces(); /** * Called before executing any actions. Gives actions a chance to perform any preparation. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java index abfc1b9698..65a118ecbe 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java @@ -423,7 +423,7 @@ public class ActionQueue { beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() ); } if ( session.getFactory().getSessionFactoryOptions().isQueryCacheEnabled() ) { - invalidateSpaces( (String[]) executable.getPropertySpaces() ); + invalidateSpaces( executable.getPropertySpaces() ); } if ( executable.getAfterTransactionCompletionProcess() != null ) { if ( afterTransactionProcesses == null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java index a1e5030b40..5230849f4c 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java @@ -6,7 +6,6 @@ */ package org.hibernate.persister.collection; -import java.io.Serializable; import java.util.Comparator; import java.util.Map; import java.util.Set; @@ -255,7 +254,7 @@ public interface CollectionPersister extends Restrictable { /** * Get the "space" that holds the persistent state */ - Serializable[] getCollectionSpaces(); + String[] getCollectionSpaces(); /** * Get the user-visible metadata for the collection (optional operation) diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java index 1c41e8dfe6..72fd57cbf3 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java @@ -210,7 +210,7 @@ public interface EntityPersister extends EntityMappingType, RootTableGroupProduc * * @return The property spaces. */ - Serializable[] getPropertySpaces(); + String[] getPropertySpaces(); /** * Returns an array of objects that identify spaces in which properties of diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index c3f9191e55..6ce853182a 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -6,7 +6,6 @@ */ package org.hibernate.persister.entity; -import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -873,7 +872,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return spaces; // don't need subclass tables, because they can't appear in conditions } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java index c2898a488d..c046aa64a0 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java @@ -6,7 +6,6 @@ */ package org.hibernate.persister.entity; -import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -502,7 +501,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return spaces; } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java index 6661f7e295..d98449cdf4 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java @@ -341,7 +341,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return spaces; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java index 3c73ffab10..f8bc9f5326 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java @@ -250,8 +250,8 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { } @Override - public Serializable[] getPropertySpaces() { - return new Serializable[0]; + public String[] getPropertySpaces() { + return new String[0]; } @Override @@ -924,8 +924,8 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { return false; //To change body of implemented methods use File | Settings | File Templates. } - public Serializable[] getCollectionSpaces() { - return new Serializable[0]; //To change body of implemented methods use File | Settings | File Templates. + public String[] getCollectionSpaces() { + return new String[0]; //To change body of implemented methods use File | Settings | File Templates. } public CollectionMetadata getCollectionMetadata() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/NonSortedExecutableListTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/NonSortedExecutableListTest.java index ccb2cab44f..05fa4aeed9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/NonSortedExecutableListTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/NonSortedExecutableListTest.java @@ -40,7 +40,7 @@ public class NonSortedExecutableListTest { private static class AnExecutable implements ComparableExecutable { private final int n; - private final Serializable[] spaces; + private final String[] spaces; private transient boolean afterDeserializeCalled; @@ -75,7 +75,7 @@ public class NonSortedExecutableListTest { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return spaces; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/SortedExecutableListTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/SortedExecutableListTest.java index 9a3304dfc6..88df6b919e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/SortedExecutableListTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/engine/action/SortedExecutableListTest.java @@ -39,7 +39,7 @@ public class SortedExecutableListTest { private static class AnExecutable implements ComparableExecutable { private final int n; - private Serializable[] spaces; + private String[] spaces; private transient boolean afterDeserializeCalled; public AnExecutable(int n, String... spaces) { @@ -73,7 +73,7 @@ public class SortedExecutableListTest { } @Override - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return spaces; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java index 3580df4157..338989dd18 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java @@ -277,8 +277,8 @@ public class PersisterClassProviderTest { } @Override - public Serializable[] getPropertySpaces() { - return new Serializable[0]; + public String[] getPropertySpaces() { + return new String[0]; } @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java index 4bb3bf075a..5c23d8e248 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java @@ -594,7 +594,7 @@ public class CustomPersister implements EntityPersister { return "CUSTOMS"; } - public Serializable[] getPropertySpaces() { + public String[] getPropertySpaces() { return new String[] { "CUSTOMS" }; } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockCollectionPersister.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockCollectionPersister.java index 1cac8e7779..f4d537c138 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockCollectionPersister.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockCollectionPersister.java @@ -16,8 +16,6 @@ import org.hibernate.type.ListType; import org.hibernate.type.MapType; import org.hibernate.type.Type; -import java.io.Serializable; - import static org.hibernate.internal.util.StringHelper.root; import static org.hibernate.jpamodelgen.validation.MockSessionFactory.typeConfiguration; @@ -146,8 +144,8 @@ public abstract class MockCollectionPersister implements QueryableCollection { } @Override - public Serializable[] getCollectionSpaces() { - return new Serializable[] {role}; + public String[] getCollectionSpaces() { + return new String[] {role}; } @Override diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockEntityPersister.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockEntityPersister.java index cc74f73333..b6aabcbf28 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockEntityPersister.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockEntityPersister.java @@ -173,8 +173,8 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable, } @Override - public Serializable[] getPropertySpaces() { - return new Serializable[] {entityName}; + public String[] getPropertySpaces() { + return new String[] {entityName}; } @Override