Skip to content

TarsInputStreamExt.read实现方法 #12

@weikano

Description

@weikano

不明白为什么要获取TarsStructInfo。如果是自动生成的代码,那么已经有生成好的readFrom(TarsInputStream)方法,直接通过反射获取到readFrom方法,然后invoke不就好了?

获取TarsStructInfo反而会造成有tars里面如果定义的结构有嵌套,在这边直接死循环。

//省略验证以及HeadData那部分
T result = CommonUtils.newInstance(e::class.java);
Method readFrom = e.getClass().getDeclaredMethod("readFrom",TarsInputStream.class);
readFrom.invoke(result, jis);
return result;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions