Draft language spec for JEP 355: Text Blocks

Alex Buckley alex.buckley at oracle.com
Mon Jun 3 19:20:39 UTC 2019

On 5/21/2019 12:45 PM, Alex Buckley wrote:
> On 5/21/2019 5:51 AM, Brian Goetz wrote:
>> As string literals get longer, the cost-benefit of interning get
>> worse, and eventually turn negative; it is super-unlikely that two
>> compilation units will use the same 14-line snippet of JSON (no
>> benefit), and at the same time, we’re taking up much more space in
>> the intern table (more cost).
>> Surely today we’ll use Constant_String_info because that’s the
>> sensible translation target, and if the same string appears twice in
>> a single class, it’ll automatically get merged by the constant pool
>> writer.  But committing forever to interning seems likely to be
>> something we’ll eventually regret, without buying us very much.  Even
>> the migration benefit seems questionable.
> OK, I have walked back the requirement to intern text blocks in 3.10.6
> and 12.5. Spec updated in place
> (http://cr.openjdk.java.net/~abuckley/jep355/text-blocks-jls.html), old
> version available
> (http://cr.openjdk.java.net/~abuckley/jep355/text-blocks-jls-20190520.html).

Thanks to the scrutiny of the CSR process, we realized the need to state 
plainly that all text blocks are constant expressions. And, since text 
blocks are of type String, and all String-typed constant expressions are 
interned, the outcome is that all text blocks must be interned. I have 
updated http://cr.openjdk.java.net/~abuckley/jep355/text-blocks-jls.html 
to reflect this.


More information about the amber-spec-experts mailing list