String templates and constant expressions
Brian Goetz
brian.goetz at oracle.com
Mon Apr 17 15:26:43 UTC 2023
> Note that we discussed about introducing method references in
> annotation for Java 8.
> This is now a little simpler because, since 11, we have constant
> dynamic and we can extend the annotation tag "c" to work with any
> constants provided by a constant dynamic instead of only "constant
> classes" (the same way the meaning of the opcode ldc was extended to
> support constant dynamic).
This is definitely a convenience for implementation, though there are
also other considerations that might influence the design of the
attribute in other directions. In general, we are likely to remain
extremely conservative about putting "more stuff in annotations".
>
> At least for ASM and the reflection, this change does not change the
> API, only the implementation.
True for ASM because it uses Object and then uses instanceof chains to
make sure you've provided a good kind of Object, but not necessarily
true for all bytecode APIs, which might use sealed types.
> This is still a big change, javac and the VM needs to be updated but
> this is less scary than before constant dynamic was introduced.
Yes, not only an invasive implementation change, but there are also some
nontrivial design questions as well. (Annotations prove once again to
be "the gift that keeps on giving".)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20230417/088b7045/attachment-0001.htm>
More information about the amber-spec-experts
mailing list