Jeremy Field
Jeremy Field

Reputation: 692

Why is there "No matching ctor" for seemingly unambiguous type-hinted constructor call?

Using Netty from Clojure, the following theoretically unambiguous constructor call fails to resolve, both in Cursive (which incorrectly lists both 3-arity options for disambiguation) and in the REPL (which throws IllegalArgumentException No matching ctor). The un-hinted version also fails in the same way.

(DefaultFullHttpResponse. protocol status ^ByteBuf buffer)

Available constructor signatures are:

Why?

Upvotes: 1

Views: 69

Answers (1)

Jeremy Field
Jeremy Field

Reputation: 692

I was able to get this working by "redundantly" hinting the first argument as well:

(DefaultFullHttpResponse. ^HttpVersion protocol status ^ByteBuf buffer)

This was surprising!

Upvotes: 1

Related Questions