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

Paul Sandoz psandoz at openjdk.org
Mon Jan 6 22:30:59 UTC 2025


On Mon, 6 Jan 2025 14:04:13 GMT, Maurizio Cimadamore <mcimadamore 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).

I am not very concerned about performance in the Interpreter, but i am all for reducing the complexity!
Having an internal interface will reduce the complexity.

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

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


More information about the babylon-dev mailing list