diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/converter/WxPayOrderNotifyResultConverter.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/converter/WxPayOrderNotifyResultConverter.java index dd6f451d9..0f0135863 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/converter/WxPayOrderNotifyResultConverter.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/converter/WxPayOrderNotifyResultConverter.java @@ -110,8 +110,11 @@ public class WxPayOrderNotifyResultConverter extends AbstractReflectionConverter Object val = context.convertAnother(obj, field.getType()); try { if (val != null) { - //这里加一个看似多余的(String)强转可解决高jdk版本下的编译报错问题,详情见讨论https://github.com/vaadin/framework/issues/10737 - PropertyDescriptor pd = new PropertyDescriptor(field.getName(), obj.getClass()); + /* + 这里加一个看似多余的(String)强转可解决高jdk版本下的编译报错问题, + 详情见讨论https://github.com/vaadin/framework/issues/10737 + */ + PropertyDescriptor pd = new PropertyDescriptor((String) field.getName(), obj.getClass()); pd.getWriteMethod().invoke(obj, val); } } catch (Exception ignored) { @@ -129,9 +132,7 @@ public class WxPayOrderNotifyResultConverter extends AbstractReflectionConverter private WxPayOrderNotifyCoupon getElement(Map coupons, String nodeName) { Integer index = Integer.valueOf(StringUtils.substringAfterLast(nodeName, "_")); - if (coupons.get(index) == null) { - coupons.put(index, new WxPayOrderNotifyCoupon()); - } + coupons.computeIfAbsent(index, k -> new WxPayOrderNotifyCoupon()); return coupons.get(index); }