修复 ThreadUtil.getMainThread在JDK25中返回null的问题(pr#1416@Gitee)

This commit is contained in:
Looly
2025-12-24 18:22:35 +08:00
parent 562948add5
commit 7ab96729ea
2 changed files with 2 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
* 【core 】 修复`CharSequenceUtil.move`方法在局部循环位移中输出不符合预期问题issue#IDD181@Gitee
* 【bloomFilter】 修复`AbstractFilter``init`方法在`maxValue`小于`machineNum`时导致数组越界异常pr#4189@Github
* 【ai 】 修复`Models`枚举命名大小写混用问题pr#4185@Github
* 【core 】 修复 `ThreadUtil.getMainThread`在JDK25中返回null的问题pr#1416@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.42(2025-11-28)

View File

@@ -553,7 +553,7 @@ public class ThreadUtil {
*/
public static Thread getMainThread() {
for (Thread thread : getThreads()) {
if (MAIN_THREAD_NAME.equals(thread.getName())) {
if (1 == thread.getId() || MAIN_THREAD_NAME.equals(thread.getName())) {
return thread;
}
}