Skip to content

使用自定义类型数组参数报错: argument type mismatch #1019

Description

@javeme

Describe the bug

RPC服务的方法中,参数使用自定义类型数组时(且自定义类型是接口interface),客户端调用后报错: argument type mismatch

Expected behavior

希望可以使用任何类型的数组作为参数。比如有interface Id,可使用Id[]作为方法参数。

Actual behavior

服务端调用业务方法时,Object[]无法转换为Id[]而报错:
image

更多记录信息可参考:https://blog.csdn.net/javeme/article/details/113802090

Steps to reproduce

Minimal yet complete reproducer code (or GitHub URL to code)

public interface CacheNotifier {
    void invalid2(Id[] ids);
}

public interface Id {
    ...
}

public void test() {
    CacheNotifier proxy = consumerConfig.setInterfaceId(CacheNotifier.class).refer();
    proxy.invalid2(new Id[]{new LongId(1)});
}

Environment

  • SOFARPC version: 5.7.6
  • JVM version (e.g. java -version): 8
  • OS version (e.g. uname -a): Mac
  • Maven version:
  • IDE version: eclipse

Metadata

Metadata

Assignees

No one assigned

    Labels

    remindTo be further discussed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions