修复 sa-token-jfinal-plugin 模块代码警告

This commit is contained in:
click33 2023-05-16 15:43:51 +08:00
parent 3b52c09b01
commit b1d2306b7d
3 changed files with 7 additions and 7 deletions

View File

@ -22,14 +22,14 @@ import java.util.regex.Pattern;
public class PathAnalyzer {
private static Map<String, PathAnalyzer> cached = new LinkedHashMap<>();
private Pattern pattern;
private static final Map<String, PathAnalyzer> cached = new LinkedHashMap<>();
private final Pattern pattern;
public static PathAnalyzer get(String expr) {
PathAnalyzer pa = (PathAnalyzer)cached.get(expr);
PathAnalyzer pa = cached.get(expr);
if (pa == null) {
synchronized(expr.intern()) {
pa = (PathAnalyzer)cached.get(expr);
pa = cached.get(expr);
if (pa == null) {
pa = new PathAnalyzer(expr);
cached.put(expr, pa);
@ -41,7 +41,7 @@ public class PathAnalyzer {
}
private PathAnalyzer(String expr) {
this.pattern = Pattern.compile(exprCompile(expr), 2);
this.pattern = Pattern.compile(exprCompile(expr), Pattern.CASE_INSENSITIVE);
}
public Matcher matcher(String uri) {

View File

@ -132,7 +132,7 @@ public class SaTokenActionHandler extends ActionHandler {
/**
* 抽取出该方法是为了缩短 handle 方法中的代码量确保获得 JIT 优化
* 方法长度超过 8000 个字节码时将不会被 JIT 编译成二进制码
*
* <p>
* 通过开启 java -XX:+PrintCompilation 启动参数得知handle(...)
* 方法(73 行代码)已被 JIT 优化优化后的字节码长度为 593 个字节相当于
* 每行代码产生 8.123 个字节

View File

@ -235,7 +235,7 @@ public class SaTokenDaoRedis implements SaTokenDao {
@Override
public List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType) {
Set<String> keys = redis.keys(prefix + "*" + keyword + "*");
List<String> list = new ArrayList<String>(keys);
List<String> list = new ArrayList<>(keys);
return SaFoxUtil.searchList(list, start, size, sortType);
}