From 16ea41482f698734f6f704cdbe9f585e4fd09f37 Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Sat, 12 Apr 2025 04:05:21 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0=20TODO=20=E4=BA=8B?= =?UTF-8?q?=E9=A1=B9=EF=BC=9A=E5=BE=85=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=20`PagingAndSortingQueryParamsTests#testGson?= =?UTF-8?q?`=20=E5=9C=A8=20JDK17=20=E6=89=A7=E8=A1=8C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 该用例在 JDK17 环境下使用 Gson 进行系列化时,报 `com.google.gson.JsonIOException: Failed making field 'java.time.LocalDateTime#date' accessible; either increase its visibility or write a custom TypeAdapter for its declaring type.`。 See: https://github.com/google/gson/blob/main/Troubleshooting.md#reflection-inaccessible --- .../commons/model/dto/test/PagingAndSortingQueryParamsTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/xyz/zhouxy/plusone/commons/model/dto/test/PagingAndSortingQueryParamsTests.java b/src/test/java/xyz/zhouxy/plusone/commons/model/dto/test/PagingAndSortingQueryParamsTests.java index 2810acc..eae1301 100644 --- a/src/test/java/xyz/zhouxy/plusone/commons/model/dto/test/PagingAndSortingQueryParamsTests.java +++ b/src/test/java/xyz/zhouxy/plusone/commons/model/dto/test/PagingAndSortingQueryParamsTests.java @@ -212,6 +212,7 @@ public class PagingAndSortingQueryParamsTests { List list = accountQueries.queryAccountList(params, pagingParams); long count = accountQueries.countAccount(params); PageResult accountPageResult = PageResult.of(list, count); + // TODO [修复] 从 JDK 17 开始,也允许使用反射访问内部字段,所以这里会报错。参考 https://github.com/google/gson/blob/main/Troubleshooting.md#reflection-inaccessible log.info(gson.toJson(accountPageResult)); assertEquals(Lists.newArrayList(