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

_writeObject字段丢失 #120

Open
justinyueh opened this issue Jul 9, 2019 · 1 comment
Open

_writeObject字段丢失 #120

justinyueh opened this issue Jul 9, 2019 · 1 comment

Comments

@justinyueh
Copy link

justinyueh commented Jul 9, 2019

{
  "$class": "java.util.List",
  "$": [
    {
      "$class": "a",
      "$": {
        "id": {
          "$class": "java.lang.Long",
          "$": "33341"
        },
        "status": {
          "$class": "java.lang.Integer",
          "$": 2
        }
      }
    },
    {
      "$class": "a",
      "$": {
        "id": {
          "$class": "java.lang.Long",
          "$": "33342"
        },
        "status": {
          "$class": "java.lang.Integer",
          "$": 3
        },
        "reason": {
          "$class": "java.lang.Integer",
          "$": 33
        }
      }
    }
  ]
}

这种情况reason字段会丢失,麻烦看一下

@Catlite91
Copy link

Catlite91 commented Dec 10, 2020

因为首次解析类的时候已经定义好类型了
hessian这边看起来不大好处理,class必须严格按照定义。
这种情况可以在上层控制,例如自动通过类型补全参数。

{
  "$class": "java.util.List",
  "$": [
    {
      "$class": "a",
      "$": {
        "id": {
          "$class": "java.lang.Long",
          "$": "33341"
        },
        "status": {
          "$class": "java.lang.Integer",
          "$": 2
        },
        "reason": {
          "$class": "java.lang.Integer",
          "$": null
        }
      }
    },
    {
      "$class": "a",
      "$": {
        "id": {
          "$class": "java.lang.Long",
          "$": "33342"
        },
        "status": {
          "$class": "java.lang.Integer",
          "$": 3
        },
        "reason": {
          "$class": "java.lang.Integer",
          "$": 33
        }
      }
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants