3
曖昧參考超載定義我越來越斯卡拉以下錯誤:如何解決階
ambiguous reference to overloaded definition,
both method register in trait Configurable of type (x$1: Any, x$2: <repeated...>[Class[_]])javax.ws.rs.client.Client
and method register in trait Configurable of type (x$1: Any) javax.ws.rs.client.Client
match argument types (Object)
[ERROR] client.register(ClientFilter.getFilter().asInstanceOf[Object])
不應該asInstance [對象]通知編譯器要使用的球衣客戶寄存器的版本?下面的代碼:
val client: Client =
ClientBuilder.newBuilder()
.build();
client.register(ClientFilter.getFilter().asInstanceOf[Object])
ClientFilter.getFilter()是ClientRequestFilter
您正在訪問https://issues.scala-lang.org/browse/SI-2991 –
其中一種解決方法可能也是使用無可變參數的方法,例如'public C register(Object component,int priority );'從'javax.ws.rs.core.Configurable'。像這樣'.register(new SomeFilter,1)' – rpozarickij
@rpozarickij更好。 –