RFR: [type-classes] Initial work to enable type-classes mediated operator support [v2]

Chen Liang liach at openjdk.org
Mon Jan 26 01:56:25 UTC 2026


On Sun, 25 Jan 2026 22:15:04 GMT, Sylv <duke at openjdk.org> wrote:

> Why `__witness`? Why can't it be an annotation like `@Witness` or even `@OperatorOverload`?

I think the use of a keyword over annotation signifies the semantic impact of such a declaration.

> Also, why an anonymous class???

This is a freedom of implementation, the witness just wants an object. And anonymous class is usually the fastest way to create an object out of an interface. You can use other class declarations or lambda expressions too if the grammar allows.

-------------

PR Comment: https://git.openjdk.org/valhalla/pull/1948#issuecomment-3797594516


More information about the valhalla-dev mailing list