ClassUtils: deprecate methods with typos
The `ClassUtils.isKotlinFaction0()` and `ClassUtils.isKotlinFaction1()` are wrong names. * Deprecate `ClassUtils.isKotlinFaction0()` and `ClassUtils.isKotlinFaction1()` in favor of newly introduced `isKotlinFunction0()` and `isKotlinFunction1()` **Cherry-pick to `main`**
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -196,15 +196,6 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
|
||||
return this.beanFactory.getBean(handlerBeanName, MessageHandler.class);
|
||||
}
|
||||
|
||||
private void orderable(Method method, MessageHandler handler) {
|
||||
if (handler instanceof Orderable) {
|
||||
Order orderAnnotation = AnnotationUtils.findAnnotation(method, Order.class);
|
||||
if (orderAnnotation != null) {
|
||||
((Orderable) handler).setOrder(orderAnnotation.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void producerOrRouter(List<Annotation> annotations, MessageHandler handler) {
|
||||
if (handler instanceof AbstractMessageProducingHandler || handler instanceof AbstractMessageRouter) {
|
||||
String sendTimeout = MessagingAnnotationUtils.resolveAttribute(annotations, "sendTimeout", String.class);
|
||||
@@ -611,7 +602,7 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
|
||||
@Nullable
|
||||
protected MessageProcessor<?> buildLambdaMessageProcessorForBeanMethod(Method method, Object target) {
|
||||
if ((target instanceof Function || target instanceof Consumer) && ClassUtils.isLambda(target.getClass())
|
||||
|| ClassUtils.isKotlinFaction1(target.getClass())) {
|
||||
|| ClassUtils.isKotlinFunction1(target.getClass())) {
|
||||
|
||||
ResolvableType methodReturnType = ResolvableType.forMethodReturnType(method);
|
||||
Class<?> expectedPayloadType = methodReturnType.getGeneric(0).toClass();
|
||||
@@ -622,6 +613,15 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
|
||||
}
|
||||
}
|
||||
|
||||
private static void orderable(Method method, MessageHandler handler) {
|
||||
if (handler instanceof Orderable) {
|
||||
Order orderAnnotation = AnnotationUtils.findAnnotation(method, Order.class);
|
||||
if (orderAnnotation != null) {
|
||||
((Orderable) handler).setOrder(orderAnnotation.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses must implement this method to create the MessageHandler.
|
||||
* @param bean The bean.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -98,11 +98,11 @@ public class InboundChannelAdapterAnnotationPostProcessor extends
|
||||
Class<?> targetClass = target.getClass();
|
||||
Assert.isTrue(MessageSource.class.isAssignableFrom(targetClass) ||
|
||||
Supplier.class.isAssignableFrom(targetClass) ||
|
||||
ClassUtils.isKotlinFaction0(targetClass),
|
||||
ClassUtils.isKotlinFunction0(targetClass),
|
||||
() -> "The '" + this.annotationType + "' on @Bean method " + "level is allowed only for: " +
|
||||
MessageSource.class.getName() + " or " + Supplier.class.getName() +
|
||||
MessageSource.class.getName() + ", or " + Supplier.class.getName() +
|
||||
(ClassUtils.KOTLIN_FUNCTION_0_CLASS != null
|
||||
? " or " + ClassUtils.KOTLIN_FUNCTION_0_CLASS.getName()
|
||||
? ", or " + ClassUtils.KOTLIN_FUNCTION_0_CLASS.getName()
|
||||
: "") + " beans");
|
||||
if (target instanceof MessageSource<?>) {
|
||||
messageSource = (MessageSource<?>) target;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -250,21 +250,46 @@ public abstract class ClassUtils {
|
||||
* @param aClass the {@link Class} to check.
|
||||
* @return true if class is a {@code kotlin.jvm.functions.Function0} implementation.
|
||||
* @since 5.2
|
||||
* @deprecated since 5.5.14 in favor of {@link #isKotlinFunction0(Class)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isKotlinFaction0(Class<?> aClass) {
|
||||
return KOTLIN_FUNCTION_0_CLASS != null && KOTLIN_FUNCTION_0_CLASS.isAssignableFrom(aClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if class is {@code kotlin.jvm.functions.Function0}.
|
||||
* @param aClass the {@link Class} to check.
|
||||
* @return true if class is a {@code kotlin.jvm.functions.Function0} implementation.
|
||||
* @since 5.5.14
|
||||
*/
|
||||
public static boolean isKotlinFunction0(Class<?> aClass) {
|
||||
return KOTLIN_FUNCTION_0_CLASS != null && KOTLIN_FUNCTION_0_CLASS.isAssignableFrom(aClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if class is {@code kotlin.jvm.functions.Function1}.
|
||||
* @param aClass the {@link Class} to check.
|
||||
* @return true if class is a {@code kotlin.jvm.functions.Function1} implementation.
|
||||
* @since 5.2
|
||||
* @deprecated since 5.5.14 in favor of {@link #isKotlinFunction1(Class)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isKotlinFaction1(Class<?> aClass) {
|
||||
return KOTLIN_FUNCTION_1_CLASS != null && KOTLIN_FUNCTION_1_CLASS.isAssignableFrom(aClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if class is {@code kotlin.jvm.functions.Function1}.
|
||||
* @param aClass the {@link Class} to check.
|
||||
* @return true if class is a {@code kotlin.jvm.functions.Function1} implementation.
|
||||
* @since 5.5.14
|
||||
*/
|
||||
public static boolean isKotlinFunction1(Class<?> aClass) {
|
||||
return KOTLIN_FUNCTION_1_CLASS != null && KOTLIN_FUNCTION_1_CLASS.isAssignableFrom(aClass);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if class is {@code kotlin.Unit}.
|
||||
* @param aClass the {@link Class} to check.
|
||||
|
||||
Reference in New Issue
Block a user