Tag: rmi

如何为接口中的属性指定@Throws

我目前正在将一些Java RMI代码移植到Kotlin。 Java中的传统接口是: interface Foo: Remote { Bar getBar() throws RemoteException } 在运行自动迁移工具之后,字段bar被更改为一个属性: interface Foo: Remote { val bar: Bar } 但是,在迁移的程序中, getBar不再被标记为throws RemoteException ,这将导致在RMI调用中illegal remote method encountered错误。 我想知道是否有任何方式来标记@Throws的财产?