fury icon indicating copy to clipboard operation
fury copied to clipboard

java.lang.UnsupportedOperationException: Class class java.util.LinkedHashMap$Entry doesn't support serialization

Open DemonJun opened this issue 1 year ago • 0 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Version

0.7.1

Component(s)

Java

Minimal reproduce step

 List<Class<?>> NEED_REGISTER_CLASS = List.of(JSONObject.class, JSONArray.class);
    Fury fury =
        Fury.builder()
            .withLanguage(Language.JAVA)
            .withClassLoader(Thread.currentThread().getClass().getClassLoader())
            .withRefTracking(false)
            .withNumberCompressed(true)
            .withLongCompressed(true)
            .withStringCompressed(true)
            .registerGuavaTypes(true)
            // 关闭类型注册
            .requireClassRegistration(false)
            // 开启异步编译,提高第一次序列化效率
            .withAsyncCompilation(true)
            .build();
    AllowListChecker classChecker = new AllowListChecker();
    for (Class<?> aclass : NEED_REGISTER_CLASS) {
      fury.register(aclass);
    }

    // 因为关闭了 类型注册检查,这里额外添加一些,运行序列化的类前缀路径,尽量为了安全
    classChecker.allowClass("sun.util.calendar.ZoneInfo");

    fury.getClassResolver().setClassChecker(classChecker);

    JSONObject data = JSONObject.of();
    data.put("a",1);

    JSONObject copy = fury.copy(data);
    System.out.println(copy);

What did you expect to see?

可以正常序列化 map 类型

What did you see instead?

downgrade to 0.7.0

Anything Else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

DemonJun avatar Sep 26 '24 02:09 DemonJun