STR behavior
Remi Forax
forax at univ-mlv.fr
Tue Jul 25 09:38:05 UTC 2023
Currently javac uses a trick to rewrite STR."" template to more or less the string concatenation equivalent, by passing the call to the bootstrap method of the string template runtime.
But this rewriting
- has a side effect at runtime, the class StringTemplate is not loaded.
- exact behavior is slightly different from the string concatenation, constant strings are not pre-computed, so the exact behavior is not an existing behavior.
- only works with the unqualified STR (where STR is a static import implicit or explicit) but not with a qualified reference to StringTemplate.STR.
I think we need something in the spec saying that this is a valid source code transformation specific to STR, that it works in the qualified and unqualified case and that the transformations should be the same as with the string concatenation.
regards,
Rémi
More information about the amber-spec-experts
mailing list