Remove deprecated code

Closes gh-29160
This commit is contained in:
Stephane Nicoll 2022-09-15 16:22:25 +02:00
parent c2c324be9b
commit 671f843d34
3 changed files with 2 additions and 101 deletions

View File

@ -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

View File

@ -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<ExecutableHint.Builder> 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<ExecutableHint.Builder> methodHint) {
return registerType(TypeReference.of(method.getDeclaringClass()),
typeHint -> typeHint.withMethod(method.getName(), mapParameters(method), methodHint));
}
private List<TypeReference> mapParameters(Executable executable) {
return TypeReference.listOf(executable.getParameterTypes());
}

View File

@ -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<TypeReference> 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<TypeReference> parameterTypes,
private Builder withConstructor(List<TypeReference> parameterTypes,
Consumer<ExecutableHint.Builder> constructorHint) {
ExecutableKey key = new ExecutableKey("<init>", 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<TypeReference> 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<TypeReference> parameterTypes,
private Builder withMethod(String name, List<TypeReference> parameterTypes,
Consumer<ExecutableHint.Builder> methodHint) {
ExecutableKey key = new ExecutableKey(name, parameterTypes);
ExecutableHint.Builder builder = this.methods.computeIfAbsent(key,