<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Thank you for pointing that out. We will revise.<br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Nov 13, 2023, at 5:03 PM, Ella Ananeva <ella.ananeva@oracle.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Hi team,<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Reading the JEP 459 spec, I see this:<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">The static members<span class="Apple-converted-space"> </span><code style="font-family: "Courier New";"><span style="font-size: 10pt;">STR</span></code><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><code style="font-family: "Courier New";"><span style="font-size: 10pt;">RAW</span></code><span class="Apple-converted-space"> </span>declared
in the predefined interface<span class="Apple-converted-space"> </span><code style="font-family: "Courier New";"><span style="font-size: 10pt;">StringTemplate</span></code>, as if the declarations<span class="Apple-converted-space"> </span><code style="font-family: "Courier New";"><span style="font-size: 10pt;">import
static java.lang.StringTemplate.STR;</span></code><span class="Apple-converted-space"> </span>and<code style="font-family: "Courier New";"><span style="font-size: 10pt;">import static java.lang.StringTemplate.RAW;</span></code><span class="Apple-converted-space"> </span>appeared
at the beginning of each compilation unit immediately after any<span class="Apple-converted-space"> </span><code style="font-family: "Courier New";"><span style="font-size: 10pt;">package</span></code><span class="Apple-converted-space"> </span>declaration.<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">As a result, the names of all <strong><span style="font-family: Calibri, sans-serif;">implicitly imported</span></strong><span class="Apple-converted-space"> </span> <strong><span style="font-family: Calibri, sans-serif;">classes,
interfaces and static fields</span></strong><span class="Apple-converted-space"> </span>are available as simple names in every compilation unit.<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">So, I assume this should work:<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif; background: white;">
<span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 51, 179);">package<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: "Courier New";">test</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(8, 8, 8);">;<br>
<br>
</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 51, 179);">public class<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: "Courier New";">Example<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(8, 8, 8);">{<br>
<br>
<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 51, 179);">public static void<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 98, 122);">main</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(8, 8, 8);">(</span><span style="font-size: 10pt; font-family: "Courier New";">String<span class="Apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(8, 8, 8);">argv[])
{<o:p></o:p></span></div>
<pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: "Courier New"; background: white;"><span style="color: rgb(0, 51, 179);"> int </span><span style="">a </span><span style="color: rgb(8, 8, 8);">= </span><span style="color: rgb(23, 80, 235);">1</span><span style="color: rgb(8, 8, 8);">;<br> </span><span style="">StringTemplate raw </span><span style="color: rgb(8, 8, 8);">= RAW.</span><span style="color: rgb(6, 125, 23);">"<span style="background: rgb(255, 204, 204);">\{</span>a}"</span><span style="color: rgb(8, 8, 8);">;<br> }<br>}<o:p></o:p></span></pre>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-family: "Courier New";"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">But I get<span class="Apple-converted-space"> </span><o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="s1">java:7: error: cannot find symbol</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span><span class="s1">StringTemplate raw = RAW."\{a + b}";</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span><span class="s1">^</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span><span class="s1">symbol:<span class="Apple-converted-space"> </span></span><span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span><span class="s1">variable
RAW</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span><span class="s1">location: class Example</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="s1">java --version</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="s1">java 22-internal 2024-03-19</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="s1">Java(TM) SE Runtime Environment (build 22-internal-2023-11-03-1839366.james.laskey.open)</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 8.5pt; font-family: Menlo;"><span class="s1">Java HotSpot(TM) 64-Bit Server VM (build 22-internal-2023-11-03-1839366.james.laskey.open, mixed mode, sharing)</span><o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">This code compiles if I add a static import<span class="Apple-converted-space"> </span><code style="font-family: "Courier New";"><span style="font-size: 10pt;">import static java.lang.StringTemplate.RAW;<o:p></o:p></span></code></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">STR is available through static import, so it’s only RAW that causes issues.<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Could it be a bug in JDK?<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Thank you,<o:p></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Ella Ananeva</div>
</div>
</div>
</blockquote>
</div>
<br>
</body>
</html>