修复EnumUtil和AbstractCache的bug

This commit is contained in:
Looly
2026-03-02 18:09:02 +08:00
parent cff4c65245
commit b54c4cd0ff
2 changed files with 4 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.44(2026-02-09)
# 5.8.44(2026-03-02)
### 🐣新特性
* 【core 】 `NumberUtil.parseNumber`增加支持科学计数法pr#4211@Github
* 【captcha】 `AbstractCaptcha`增加`setStroke`方法支持线条粗细issue#IDJQ15@Gitee
@@ -19,6 +19,8 @@
* 【core 】 修复`JschSessionPool`回收导致的session未关闭问题issue#4223@Github
* 【core 】 修复`XmlUtil.xmlToBean`option参数无效问题issue#4226@Github
* 【core 】 修复`ReUtil.replaceAll`空指针问题issue#IDPHVW@Gitee
* 【core 】 修复`EnumUtil`枚举类静态初始化时触发 Recursive update 异常pr#1432@Gitee
* 【core 】 修复`AbstractCache`高并发下 get+supplier 双重检查锁逻辑缺陷pr#1432@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.43(2026-01-04)

View File

@@ -30,7 +30,7 @@ public class BoundedPriorityQueue<E> extends PriorityQueue<E>{
* @param comparator 比较器
*/
public BoundedPriorityQueue(int capacity, final Comparator<? super E> comparator) {
super(capacity <= 0 ? 1 : capacity, (o1, o2) -> {
super(capacity, (o1, o2) -> {
int cResult;
if(comparator != null) {
cResult = comparator.compare(o1, o2);
@@ -53,10 +53,6 @@ public class BoundedPriorityQueue<E> extends PriorityQueue<E>{
*/
@Override
public boolean offer(E e) {
if (capacity <= 0) {
// 容量为0或负数时不接受任何元素
return false;
}
if(size() >= capacity) {
E head = peek();
if (this.comparator().compare(e, head) <= 0){