From 671f843d34b00650ad527483434ec4e3602bf812 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 15 Sep 2022 16:22:25 +0200 Subject: [PATCH] Remove deprecated code Closes gh-29160 --- .../aot/hint/ExecutableHint.java | 17 ------ .../aot/hint/ReflectionHints.java | 53 ------------------- .../springframework/aot/hint/TypeHint.java | 33 +----------- 3 files changed, 2 insertions(+), 101 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/aot/hint/ExecutableHint.java b/spring-core/src/main/java/org/springframework/aot/hint/ExecutableHint.java index 1897a3cabc7..3cf8fd7474a 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/ExecutableHint.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/ExecutableHint.java @@ -122,23 +122,6 @@ public final class ExecutableHint extends MemberHint { return this; } - /** - * Set the {@linkplain ExecutableMode modes} to use. - * @param modes the mode to use - * @return {@code this}, to facilitate method chaining - * @deprecated only a single mode can be set, use {@link #withMode(ExecutableMode)} instead - */ - @Deprecated - public Builder setModes(ExecutableMode... modes) { - if (modes.length > 1) { - throw new UnsupportedOperationException(); - } - if (modes.length == 1) { - withMode(modes[0]); - } - return this; - } - /** * Create an {@link ExecutableHint} based on the state of this builder. * @return an executable hint diff --git a/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java b/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java index ec6602fa71a..5d5beb7b7c8 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java @@ -175,18 +175,6 @@ public class ReflectionHints { typeHint -> typeHint.withField(field.getName())); } - /** - * Register the need for reflection on the specified {@link Constructor}, - * enabling {@link ExecutableMode#INVOKE}. - * @param constructor the constructor that requires reflection - * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #registerConstructor(Constructor, ExecutableMode)} - */ - @Deprecated - public ReflectionHints registerConstructor(Constructor constructor) { - return registerConstructor(constructor, ExecutableMode.INVOKE); - } - /** * Register the need for reflection on the specified {@link Constructor}, * using the specified {@link ExecutableMode}. @@ -199,33 +187,6 @@ public class ReflectionHints { typeHint -> typeHint.withConstructor(mapParameters(constructor), mode)); } - /** - * Register the need for reflection on the specified {@link Constructor}. - * @param constructor the constructor that requires reflection - * @param constructorHint a builder to further customize the hints of this - * constructor - * @return {@code this}, to facilitate method chaining` - * @deprecated in favor of {@link #registerConstructor(Constructor, ExecutableMode)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public ReflectionHints registerConstructor(Constructor constructor, Consumer constructorHint) { - return registerType(TypeReference.of(constructor.getDeclaringClass()), - typeHint -> typeHint.withConstructor(mapParameters(constructor), constructorHint)); - } - - /** - * Register the need for reflection on the specified {@link Method}, - * enabling {@link ExecutableMode#INVOKE}. - * @param method the method that requires reflection - * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #registerMethod(Method, ExecutableMode)} - */ - @Deprecated - public ReflectionHints registerMethod(Method method) { - return registerMethod(method, ExecutableMode.INVOKE); - } - /** * Register the need for reflection on the specified {@link Method}, * using the specified {@link ExecutableMode}. @@ -238,20 +199,6 @@ public class ReflectionHints { typeHint -> typeHint.withMethod(method.getName(), mapParameters(method), mode)); } - /** - * Register the need for reflection on the specified {@link Method}. - * @param method the method that requires reflection - * @param methodHint a builder to further customize the hints of this method - * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #registerMethod(Method, ExecutableMode)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public ReflectionHints registerMethod(Method method, Consumer methodHint) { - return registerType(TypeReference.of(method.getDeclaringClass()), - typeHint -> typeHint.withMethod(method.getName(), mapParameters(method), methodHint)); - } - private List mapParameters(Executable executable) { return TypeReference.listOf(executable.getParameterTypes()); } diff --git a/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java b/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java index 95ccf05507f..6a0c894d252 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java @@ -196,18 +196,6 @@ public final class TypeHint implements ConditionalHint { return this; } - /** - * Register the need for reflection on the constructor with the specified - * parameter types, enabling {@link ExecutableMode#INVOKE}. - * @param parameterTypes the parameter types of the constructor - * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #withConstructor(List, ExecutableMode)} - */ - @Deprecated - public Builder withConstructor(List parameterTypes) { - return withConstructor(parameterTypes, ExecutableMode.INVOKE); - } - /** * Register the need for reflection on the constructor with the specified * parameter types, using the specified {@link ExecutableMode}. @@ -226,10 +214,8 @@ public final class TypeHint implements ConditionalHint { * @param constructorHint a builder to further customize the hints of this * constructor * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #withConstructor(List, ExecutableMode)} */ - @Deprecated - public Builder withConstructor(List parameterTypes, + private Builder withConstructor(List parameterTypes, Consumer constructorHint) { ExecutableKey key = new ExecutableKey("", parameterTypes); ExecutableHint.Builder builder = this.constructors.computeIfAbsent(key, @@ -238,19 +224,6 @@ public final class TypeHint implements ConditionalHint { return this; } - /** - * Register the need for reflection on the method with the specified name - * and parameter types, enabling {@link ExecutableMode#INVOKE}. - * @param name the name of the method - * @param parameterTypes the parameter types of the constructor - * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #withMethod(String, List, ExecutableMode)} - */ - @Deprecated - public Builder withMethod(String name, List parameterTypes) { - return withMethod(name, parameterTypes, ExecutableMode.INVOKE); - } - /** * Register the need for reflection on the method with the specified name * and parameter types, using the specified {@link ExecutableMode}. @@ -270,10 +243,8 @@ public final class TypeHint implements ConditionalHint { * @param parameterTypes the parameter types of the constructor * @param methodHint a builder to further customize the hints of this method * @return {@code this}, to facilitate method chaining - * @deprecated in favor of {@link #withMethod(String, List, ExecutableMode)} */ - @Deprecated - public Builder withMethod(String name, List parameterTypes, + private Builder withMethod(String name, List parameterTypes, Consumer methodHint) { ExecutableKey key = new ExecutableKey(name, parameterTypes); ExecutableHint.Builder builder = this.methods.computeIfAbsent(key,