[code-reflection] RFR: Make Quotable a marker interface

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jan 6 14:07:55 UTC 2025


On Tue, 31 Dec 2024 10:37:05 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

> In this PR, we make Quotable a marker interface. This PR is based on #301.

src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java line 496:

> 494:             // If a quotable lambda proxy again to add method Quoted quoted()
> 495:             if (Quotable.class.isAssignableFrom(fi)) {
> 496:                 // Op.ofQuotable(Quotable q) expect q's class to have the method: Quoted quoted()

This logic seems a bit expensive. I wonder if we could have a non-exported interface which extends Quoted and adds the quoted() method, which then the implementation knows about, but the outside world can't access. That would probably lead to cleaner code, here and elsewhere (e.g. `ofQuotable` could be implemented w/o using reflection).

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

PR Review Comment: https://git.openjdk.org/babylon/pull/302#discussion_r1904191026


More information about the babylon-dev mailing list