fix 解决 Maven 打包时的 unchecked 警告

fix 修复因使用弃用 API 导致的打包警告
This commit is contained in:
Kayleigh Wang 2026-02-28 20:27:35 +08:00
parent ed9de38c6f
commit ce30aba049
8 changed files with 13 additions and 10 deletions

View File

@ -229,9 +229,9 @@ public class AuthController {
String referer = request.getHeader("referer");
if (StringUtils.isNotBlank(referer)) {
// 这里从referer中取值是为了本地使用hosts添加虚拟域名方便本地环境调试
host = referer.split("//")[1].split("/")[0];
host = new java.net.URI(referer).getHost();
} else {
host = new URL(request.getRequestURL().toString()).getHost();
host = new java.net.URI(request.getRequestURL().toString()).getHost();
}
// 根据域名进行筛选
List<TenantListVo> list = StreamUtils.filter(voList, vo ->

View File

@ -23,7 +23,7 @@ import java.util.function.Supplier;
* @version 3.5.0
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@SuppressWarnings("unchecked cast")
@SuppressWarnings("unchecked")
public class DataPermissionHelper {
private static final String DATA_PERMISSION_KEY = "data:permission";

View File

@ -113,7 +113,7 @@ public class PlusSaTokenDao implements SaTokenDaoBySessionFollowObject {
* @param key 键名称
* @return object
*/
@SuppressWarnings("unchecked cast")
@SuppressWarnings("unchecked")
@Override
public <T> T getObject(String key, Class<T> classType) {
Object o = CAFFEINE.get(key, k -> RedisUtils.getCacheObject(key));

View File

@ -63,7 +63,7 @@ public class LoginHelper {
/**
* 获取用户(多级缓存)
*/
@SuppressWarnings("unchecked cast")
@SuppressWarnings("unchecked")
public static <T extends LoginUser> T getLoginUser() {
SaSession session = StpUtil.getTokenSession();
if (ObjectUtil.isNull(session)) {
@ -75,7 +75,7 @@ public class LoginHelper {
/**
* 获取用户基于token
*/
@SuppressWarnings("unchecked cast")
@SuppressWarnings("unchecked")
public static <T extends LoginUser> T getLoginUser(String token) {
SaSession session = StpUtil.getTokenSessionByToken(token);
if (ObjectUtil.isNull(session)) {

View File

@ -19,7 +19,8 @@ public class I18nLocaleResolver implements LocaleResolver {
Locale locale = Locale.getDefault();
if (language != null && language.length() > 0) {
String[] split = language.split("_");
locale = new Locale(split[0], split[1]);
String languageTag = String.join("-", split);
locale = Locale.forLanguageTag(languageTag);
}
return locale;
}

View File

@ -26,7 +26,7 @@ import java.util.stream.IntStream;
public class TestMapJobAnnotation {
@MapExecutor
public ExecuteResult doJobMapExecute(MapArgs mapArgs, MapHandler mapHandler) {
public ExecuteResult doJobMapExecute(MapArgs mapArgs, MapHandler<List<Integer>> mapHandler) {
// 生成1~200数值并分片
int partitionSize = 50;
List<List<Integer>> partition = IntStream.rangeClosed(1, 200)
@ -41,6 +41,7 @@ public class TestMapJobAnnotation {
@MapExecutor(taskName = "doCalc")
public ExecuteResult doCalc(MapArgs mapArgs) {
@SuppressWarnings("unchecked")
List<Integer> sourceList = (List<Integer>) mapArgs.getMapResult();
// 遍历sourceList的每一个元素,计算出一个累加值partitionTotal
int partitionTotal = sourceList.stream().mapToInt(i -> i).sum();

View File

@ -28,7 +28,7 @@ import java.util.stream.IntStream;
public class TestMapReduceAnnotation1 {
@MapExecutor
public ExecuteResult rootMapExecute(MapArgs mapArgs, MapHandler mapHandler) {
public ExecuteResult rootMapExecute(MapArgs mapArgs, MapHandler<List<Integer>> mapHandler) {
int partitionSize = 50;
List<List<Integer>> partition = IntStream.rangeClosed(1, 200)
.boxed()
@ -42,6 +42,7 @@ public class TestMapReduceAnnotation1 {
@MapExecutor(taskName = "doCalc")
public ExecuteResult doCalc(MapArgs mapArgs) {
@SuppressWarnings("unchecked")
List<Integer> sourceList = (List<Integer>) mapArgs.getMapResult();
// 遍历sourceList的每一个元素,计算出一个累加值partitionTotal
int partitionTotal = sourceList.stream().mapToInt(i -> i).sum();

View File

@ -102,7 +102,7 @@ public class FlwNodeExtServiceImpl implements NodeExtService, IFlwNodeExtService
* @param sources 数据来源枚举类或字典类型
* @return 构建的 `NodeExt` 对象
*/
@SuppressWarnings("unchecked cast")
@SuppressWarnings("unchecked")
private NodeExt buildNodeExt(String code, String name, int type, List<Object> sources) {
NodeExt nodeExt = new NodeExt();
nodeExt.setCode(code);