oh,I do not think add a new struct in dubbogo/hessian2 is a good idea. The
more definitions we create, the higher the learning cost of users. There
are slice and array in Golang which slice is a dynamic array . So why we
not create slice of interface{} type in go and arrayList (means a dynamic
array) in java mapping, array of interface{} type in go and object array
in java mapping ?
方银城 <[email protected]> 于2019年6月28日周五 下午4:57写道:
> Hi dubbogo community,
>
>
> Today, we found a problem about hessian2
> <https://github.com/dubbogo/hessian2>. What type does 'Object[]' of java
> correspond to in golang?
>
> 'Object' of java will be decoded to 'interface{}' in golang, so
> 'Object[]' should be decoded to '[]interface{}'. However, '[]interface'
> of golang will be decoded to 'ArrayList' of java.
> Then, we should distinguish 'Object[]' from 'ArrayList' in golang. And
> I will describe a case:
>
> 1. Define a Object to describe the Object in
> java.(hessian2/list.go)
> [image: image.png]
>
> 2. Add mapping from 'hessian.Object' to '[object'.
> [image: image.png]
>
> 3. Now, '[]interface{}' is equal to 'ArrayList' and '[]Object'
> is equal to 'Object[]'.
>
> Looking forward to different opinions!
>
> Yours,
>
> Yincheng Fang
>