From 9faf1da8d0e3d89e8bd0898247ff816400cb5dbf Mon Sep 17 00:00:00 2001 From: Gavin King Date: Fri, 3 Jan 2025 19:00:18 +0100 Subject: [PATCH] escalate some annotation deprecations to forRemoval=true especially the enums which names collide with JPA --- .../java/org/hibernate/annotations/AttributeAccessor.java | 2 +- .../src/main/java/org/hibernate/annotations/Cascade.java | 2 +- .../main/java/org/hibernate/annotations/CascadeType.java | 6 ++++-- .../src/main/java/org/hibernate/annotations/Checks.java | 3 +++ .../main/java/org/hibernate/annotations/FlushModeType.java | 5 +++-- .../java/org/hibernate/annotations/GenericGenerator.java | 4 ++-- .../java/org/hibernate/annotations/GenericGenerators.java | 2 +- .../java/org/hibernate/annotations/NamedNativeQuery.java | 4 ++-- .../src/main/java/org/hibernate/annotations/NamedQuery.java | 2 +- .../java/org/hibernate/annotations/ResultCheckStyle.java | 2 +- .../src/main/java/org/hibernate/annotations/SQLDelete.java | 2 +- .../main/java/org/hibernate/annotations/SQLDeleteAll.java | 2 +- .../src/main/java/org/hibernate/annotations/SQLInsert.java | 2 +- .../src/main/java/org/hibernate/annotations/SQLUpdate.java | 2 +- 14 files changed, 23 insertions(+), 17 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/AttributeAccessor.java b/hibernate-core/src/main/java/org/hibernate/annotations/AttributeAccessor.java index 324fabbd28f4..fcb576881ee2 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/AttributeAccessor.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/AttributeAccessor.java @@ -48,7 +48,7 @@ * * @deprecated use {@link #strategy()} */ - @Deprecated(since = "6.0") + @Deprecated(since = "6.0", forRemoval = true) String value() default ""; /** * A class implementing {@link PropertyAccessStrategy}. diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Cascade.java b/hibernate-core/src/main/java/org/hibernate/annotations/Cascade.java index e37893f53407..4bb77cace538 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Cascade.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Cascade.java @@ -32,7 +32,7 @@ * @deprecated Use the JPA-defined * {@link jakarta.persistence.CascadeType} */ -@Deprecated(since = "7") +@Deprecated(since = "7", forRemoval = true) @Target({METHOD, FIELD}) @Retention(RUNTIME) public @interface Cascade { diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java b/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java index d9f4c30e3744..70a80cc6ff64 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java @@ -30,9 +30,11 @@ * @see Cascade * * @deprecated Use the JPA-defined - * {@link jakarta.persistence.CascadeType} + * {@link jakarta.persistence.CascadeType}. + * This enumeration will be removed to alleviate the + * duplication in naming. */ -@Deprecated(since = "7") +@Deprecated(since = "7", forRemoval = true) public enum CascadeType { /** * Includes all types listed here. diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Checks.java b/hibernate-core/src/main/java/org/hibernate/annotations/Checks.java index b074c4f56e17..736319317a22 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Checks.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Checks.java @@ -15,10 +15,13 @@ /** * A list of {@link Check}s. * + * @deprecated since {@link Check} is deprecated. + * * @author Gavin King */ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) +@Deprecated(since = "7") public @interface Checks { Check[] value(); } diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java b/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java index c91af15f1e7b..cb80ba209afe 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java @@ -17,9 +17,10 @@ * @see NamedQuery#flushMode * @see NamedNativeQuery#flushMode * - * @deprecated use {@link QueryFlushMode} + * @deprecated Use {@link QueryFlushMode}. This enumeration will be removed to alleviate + * the duplication in naming with {@link jakarta.persistence.FlushModeType}. */ -@Deprecated(since="7") +@Deprecated(since="7", forRemoval = true) public enum FlushModeType { /** * Corresponds to {@link org.hibernate.FlushMode#ALWAYS}. diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerator.java b/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerator.java index fb400bb16ce6..25b9ddadb948 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerator.java @@ -66,7 +66,7 @@ @Target({PACKAGE, TYPE, METHOD, FIELD}) @Retention(RUNTIME) @Repeatable(GenericGenerators.class) -@Deprecated(since = "6.5") +@Deprecated(since = "6.5", forRemoval = true) public @interface GenericGenerator { /** * The name of the identifier generator. This is the name that may be specified by @@ -93,7 +93,7 @@ * * @deprecated use {@link #type()} for typesafety */ - @Deprecated(since="6.2") + @Deprecated(since="6.2", forRemoval = true) String strategy() default "native"; /** * Parameters to be passed to {@link org.hibernate.id.IdentifierGenerator#configure} diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerators.java b/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerators.java index 053142c9e401..4c5fd55dfddd 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerators.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/GenericGenerators.java @@ -20,7 +20,7 @@ */ @Target({PACKAGE, TYPE}) @Retention(RUNTIME) -@Deprecated(since = "6.5") +@Deprecated(since = "6.5", forRemoval = true) public @interface GenericGenerators { /** * The aggregated generators. diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/NamedNativeQuery.java b/hibernate-core/src/main/java/org/hibernate/annotations/NamedNativeQuery.java index 1793efca7772..004ddaa2f1ce 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/NamedNativeQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/NamedNativeQuery.java @@ -80,7 +80,7 @@ * * @deprecated use {@link #flush()} */ - @Deprecated(since = "7") + @Deprecated(since = "7", forRemoval = true) FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT; /** @@ -182,6 +182,6 @@ * * @see org.hibernate.jpa.HibernateHints#HINT_CALLABLE_FUNCTION */ - @Deprecated( since = "6.0" ) + @Deprecated(since = "6.0", forRemoval = true) boolean callable() default false; } diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/NamedQuery.java b/hibernate-core/src/main/java/org/hibernate/annotations/NamedQuery.java index c22084276e51..7d1ed37bf42a 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/NamedQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/NamedQuery.java @@ -75,7 +75,7 @@ * * @deprecated use {@link #flush()} */ - @Deprecated(since = "7") + @Deprecated(since = "7", forRemoval = true) FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT; /** diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/ResultCheckStyle.java b/hibernate-core/src/main/java/org/hibernate/annotations/ResultCheckStyle.java index 4078064660e4..eb07992ecb77 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/ResultCheckStyle.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/ResultCheckStyle.java @@ -24,7 +24,7 @@ * * @deprecated Use an {@link Expectation} class instead. */ -@Deprecated(since = "6.5") +@Deprecated(since = "6.5", forRemoval = true) public enum ResultCheckStyle { /** * No return code checking. Might mean that no checks are required, or that diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/SQLDelete.java b/hibernate-core/src/main/java/org/hibernate/annotations/SQLDelete.java index b3ad3ec324dd..19ec8aea8dc5 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/SQLDelete.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/SQLDelete.java @@ -59,7 +59,7 @@ * * @deprecated use {@link #verify()} with an {@link Expectation} class */ - @Deprecated(since = "6.5") + @Deprecated(since = "6.5", forRemoval = true) ResultCheckStyle check() default ResultCheckStyle.NONE; /** diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/SQLDeleteAll.java b/hibernate-core/src/main/java/org/hibernate/annotations/SQLDeleteAll.java index cabd4bc11428..bb7256ebaf47 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/SQLDeleteAll.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/SQLDeleteAll.java @@ -47,7 +47,7 @@ * * @deprecated use {@link #verify()} with an {@link Expectation} class */ - @Deprecated(since = "6.5") + @Deprecated(since = "6.5", forRemoval = true) ResultCheckStyle check() default ResultCheckStyle.NONE; /** diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/SQLInsert.java b/hibernate-core/src/main/java/org/hibernate/annotations/SQLInsert.java index 33af60e69b5a..86038d0e53a4 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/SQLInsert.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/SQLInsert.java @@ -75,7 +75,7 @@ * * @deprecated use {@link #verify()} with an {@link Expectation} class */ - @Deprecated(since = "6.5") + @Deprecated(since = "6.5", forRemoval = true) ResultCheckStyle check() default ResultCheckStyle.NONE; /** diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/SQLUpdate.java b/hibernate-core/src/main/java/org/hibernate/annotations/SQLUpdate.java index dc7a74c95e4d..2e22222aa8f4 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/SQLUpdate.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/SQLUpdate.java @@ -78,7 +78,7 @@ * * @deprecated use {@link #verify()} with an {@link Expectation} class */ - @Deprecated(since = "6.5") + @Deprecated(since = "6.5", forRemoval = true) ResultCheckStyle check() default ResultCheckStyle.NONE; /**