<i18n dev> RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v7]

Rémi Forax forax at openjdk.org
Fri Nov 4 08:38:42 UTC 2022


On Thu, 3 Nov 2022 14:37:55 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/template/ProcessorLinkage.java line 60:
>> 
>>> 58:      * @throws NullPointerException if any of the arguments are null
>>> 59:      */
>>> 60:     MethodHandle linkage(List<String> fragments, MethodType type);
>> 
>> I suggest changing the protocol here to be able to take all bootstrap arguments into account, and return a `CallSite` instead. That will allow a `ProcessorLinkage` to take the lookup and name into account as well, and allows returning e.g. a `MutableCallSite` as well.
>> 
>> Maybe this can still be changed later as well though, since the interface is sealed.
>
> Yes - this will all go away during preview.

I disagree with Jorn,
- CallSite.dynamicInvoker() can be used to see a `MutableCallSite` as a `MethodHandle` so returning a `MethodHandle` is as powerful as returning a `CallSite`.
- Having a `ProcessorLinkage` that takes a Lookup as parameter is a security risk because it means that a processor have full access to the user code that calls the processor at runtime.

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

PR: https://git.openjdk.org/jdk/pull/10889


More information about the i18n-dev mailing list