Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行时类型无法还原 #412

Closed
spnettec opened this issue Jun 5, 2022 · 2 comments
Closed

运行时类型无法还原 #412

spnettec opened this issue Jun 5, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@spnettec
Copy link

spnettec commented Jun 5, 2022

`

  public void test() {
          Bean bean = new Bean();
          bean.setAa(Long.valueOf(1));
          assertTrue(bean.getAa() instanceof Long);
          String str = JSON.toJSONString(bean, JSONWriter.Feature.WriteClassName);
          Bean object = JSON.parseObject(str,Bean.class,JSONReader.Feature.SupportClassForName);
          assertTrue(object.getAa() instanceof Long); // 不通过
      }

    public static class Bean {
        public Object getAa() {
            return aa;
        }

      public void setAa(Object aa) {
          this.aa = aa;
      }

      private Object aa;

  }

`

@spnettec spnettec added the bug Something isn't working label Jun 5, 2022
@wenshao wenshao added this to the 2.0.7 milestone Jun 5, 2022
@wenshao
Copy link
Member

wenshao commented Jun 8, 2022

@wenshao
Copy link
Member

wenshao commented Jun 11, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.7
问题已经修复,请用新版本

@wenshao wenshao closed this as completed Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants