add version

This commit is contained in:
Looly 2023-02-28 21:09:54 +08:00
parent 0a88978c58
commit c8707966be

View File

@ -65,11 +65,11 @@ public class LambdaFactory {
* @return 接受Lambda的函数式接口对象 * @return 接受Lambda的函数式接口对象
* @param <F> Function类型 * @param <F> Function类型
*/ */
@SuppressWarnings("unchecked")
public static <F> F build(final Class<F> functionInterfaceType, final Method method) { public static <F> F build(final Class<F> functionInterfaceType, final Method method) {
Assert.notNull(functionInterfaceType); Assert.notNull(functionInterfaceType);
Assert.notNull(method); Assert.notNull(method);
final MutableEntry<Class<?>, Method> cacheKey = new MutableEntry<>(functionInterfaceType, method); final MutableEntry<Class<?>, Method> cacheKey = new MutableEntry<>(functionInterfaceType, method);
//noinspection unchecked
return (F) CACHE.computeIfAbsent(cacheKey, key -> { return (F) CACHE.computeIfAbsent(cacheKey, key -> {
final List<Method> abstractMethods = Arrays.stream(functionInterfaceType.getMethods()) final List<Method> abstractMethods = Arrays.stream(functionInterfaceType.getMethods())
.filter(m -> Modifier.isAbstract(m.getModifiers())) .filter(m -> Modifier.isAbstract(m.getModifiers()))