From 1a82747d941a3c81ff5a7ec11425919f0e564c0a Mon Sep 17 00:00:00 2001 From: Looly Date: Sun, 23 Apr 2023 00:50:28 +0800 Subject: [PATCH] fix code --- .../java/org/dromara/hutool/core/func/LambdaFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hutool-core/src/main/java/org/dromara/hutool/core/func/LambdaFactory.java b/hutool-core/src/main/java/org/dromara/hutool/core/func/LambdaFactory.java index 971ae6ad4..356d7a8cc 100644 --- a/hutool-core/src/main/java/org/dromara/hutool/core/func/LambdaFactory.java +++ b/hutool-core/src/main/java/org/dromara/hutool/core/func/LambdaFactory.java @@ -125,6 +125,8 @@ public class LambdaFactory { final Class[] paramTypes = funcMethod.getParameterTypes(); // 函数对象将要实现的接口方法类型 final MethodType samMethodType = MethodType.methodType(funcMethod.getReturnType(), paramTypes); + // 一个直接方法句柄(DirectMethodHandle), 描述调用时将被执行的具体实现方法 + final MethodHandle implMethodHandle = LookupUtil.unreflect(executable); if (ClassUtil.isSerializable(funcType)) { return LambdaMetafactory.altMetafactory( @@ -132,7 +134,7 @@ public class LambdaFactory { invokeName, invokedType, samMethodType, - LookupUtil.unreflect(executable), + implMethodHandle, MethodTypeUtil.methodType(executable), LambdaMetafactory.FLAG_SERIALIZABLE ); @@ -143,7 +145,7 @@ public class LambdaFactory { invokeName, invokedType, samMethodType, - LookupUtil.unreflect(executable), + implMethodHandle, MethodTypeUtil.methodType(executable) ); }