fix(去除sun包): 去除sun包,兼容其他版本jdk

This commit is contained in:
zhuangpeng.li
2025-04-28 10:43:48 +08:00
parent e404cd26d4
commit a3625cd254
3 changed files with 17 additions and 9 deletions

View File

@@ -3,10 +3,10 @@ package com.fastbee.base.core.hanler;
import com.fastbee.common.core.protocol.Message;
import com.fastbee.base.session.Session;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
/**
* 基础处理类
@@ -44,8 +44,21 @@ public abstract class BaseHandler {
for (int i = 0; i < types.length; i++) {
Type type = types[i];
Class<?> clazz;
if (type instanceof ParameterizedTypeImpl) {
clazz = (Class<?>) ((ParameterizedTypeImpl) type).getActualTypeArguments()[0];
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
// 检查是否为List/Collection等容器类型
if (pt.getRawType() instanceof Class &&
((Class<?>) pt.getRawType()).isArray() ||
Collection.class.isAssignableFrom((Class<?>) pt.getRawType())) {
Type[] actualTypes = pt.getActualTypeArguments();
if (actualTypes.length > 0) {
clazz = (Class<?>) actualTypes[0];
} else {
clazz = Object.class; // 默认类型
}
} else {
clazz = (Class<?>) pt.getRawType(); // 处理非容器类型的参数化类型
}
} else {
clazz = (Class<?>) type;
}

View File

@@ -1,7 +1,6 @@
package com.fastbee.iot.ruleEngine;
import com.fastbee.common.core.redis.RedisCache;
import com.yomahub.liteflow.script.annotation.ScriptBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -12,7 +11,6 @@ import org.springframework.stereotype.Component;
*/
@Component
@Slf4j
@ScriptBean("msgContextService")
public class MsgContextService {
private final RedisCache redisCache;

View File

@@ -4,9 +4,6 @@ import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.security.MessageDigest;
import java.util.Base64;