[code-reflection] RFR: Make Quotable a marker interface [v4]
Paul Sandoz
psandoz at openjdk.org
Wed Jan 8 22:04:58 UTC 2025
On Wed, 8 Jan 2025 21:32:54 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
>> The `LambdaMetaFactory` needs updating so the FI implementation also implements the internal `Quoted2`. I don't know if there are any access control issues with the non-exported interface being defined outside of `java.base`. If so we might need an internal interface in `java.base` whose `quoted` method returns `Object`, and is exported to the code module.
>
> FI implementation can't access Quotable2 because it's not exported.
Right, so i think we need to create an interface in `java.base` in a package exported to `jdk.incubator.code` e.g., create a package in `java.base` called `jdk.internal.code` and add:
// Implementations of this interface also implement jdk.incubator.code.Quotable
interface QuotableWithQuotedAccess { // or whatever we call it
// Implementations return instances of jdk.incubator.code.Quoted
Object quoted();
}
then modify `module-info.java` in `java.base` to export package `jdk.internal.code` to module `jdk.incubator.code`.
More generally either this or the current approach will fail if the quotable functional interface is explicitly proxied via `Proxy.newProxyInstance` or `MethodHandleProxies.asInterfaceInstance`. And, regardless if we have `Quotable::quoted` proxying would fail for instances of the following:
Runnable r = (Runnable & Quotable) () -> { ... };
I think we have to specify that such proxying results in inaccessible models. Not great a great answer, but not terrible.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/302#discussion_r1907913962
More information about the babylon-dev
mailing list