<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Jaikiran Pai" <jai.forums2013@gmail.com><br><b>To: </b>"jdk-dev" <jdk-dev@openjdk.org><br><b>Sent: </b>Tuesday, July 30, 2024 5:43:34 PM<br><b>Subject: </b>Re: JEL 477 Issue<br></blockquote></div><div><style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Aptos;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#467886;
text-decoration:underline;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:11.0pt;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><p>> import module java.base;<br>
><br>
> main() {<br>
><br>
> println("Moose");<br>
><br>
>}</p>
<p>It appears that you are missing a "void" return type before the
main() method name. As noted in the JEP-477, it should be:</p>
<p>import module java.base;<br>
void main() {<br>
println("Moose");<br>
}</p></blockquote><div><br></div><div>that said, if we want beginners to be able to use that syntax, the error message should be changed because the current message is misleading and not very helpfull (javac should recognize "main" and have a tailored error message).<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>@Ken, you do not need to import module java.base, it's done by default and --source 23 is not needed anymore since 23.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><p><br>
</p>
<p>-Jaikiran</p></blockquote><div><br></div><div>regards,<br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><p><br>
</p>
<div class="moz-cite-prefix">On 30/07/24 9:05 pm, <a class="moz-txt-link-abbreviated" href="mailto:omniprof@gmail.com" target="_blank">omniprof@gmail.com</a>
wrote:<br>
</div>
<blockquote cite="mid:009e01dae296$2ced4550$86c7cff0$@gmail.com">
<div class="WordSection1">
<p class="MsoNormal">I apologize for posting what is likely a
trivial question that may be inappropriate for this list but I
cannot find anywhere in my searches to explain what is going
wrong. Simply put JEP 477 does not work in the pre-release
version of Java 23 on a Windows 11 PC. There is a lot written
that all show a similar example.</p>
<p class="MsoNormal"><b>>> Here is the program</b></p>
<p class="MsoNormal">import module java.base;</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">main() {</p>
<p class="MsoNormal"> println("Moose");</p>
<p class="MsoNormal">}</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b>>> Here is the version of Java I
am running</b></p>
<p class="MsoNormal">C:\dev\Onramptesting\OnRamptest\src>java
--version</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">openjdk 23-ea 2024-09-17</p>
<p class="MsoNormal">OpenJDK Runtime Environment (build
23-ea+34-2361)</p>
<p class="MsoNormal">OpenJDK 64-Bit Server VM (build
23-ea+34-2361, mixed mode, sharing)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b>>> Here I run the code with all
the required switches. The errors are the same with or
without Xlint</b></p>
<p class="MsoNormal">C:\dev\Onramptesting\OnRamptest\src>javac
--enable-preview --source 23 -Xlint:preview Main.java</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Main.java:1: warning: [preview] module
imports are a preview feature and may be removed in a future
release.</p>
<p class="MsoNormal">import module java.base;</p>
<p class="MsoNormal"> ^</p>
<p class="MsoNormal">Main.java:3: error: class, interface, enum,
or record expected</p>
<p class="MsoNormal">main() {</p>
<p class="MsoNormal">^</p>
<p class="MsoNormal">Main.java:5: error: class, interface, enum,
or record expected</p>
<p class="MsoNormal">}</p>
<p class="MsoNormal">^</p>
<p class="MsoNormal">2 errors</p>
<p class="MsoNormal">1 warning</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Note that I get the same results for
–source 23 and –release 23</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Trying single file:</p>
<p class="MsoNormal">java –enable-preview Main.java</p>
<p class="MsoNormal">does not work as well.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Same result using Console or PowerShell in
Windows.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">What am I doing wrong? </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Ken Fogel</p>
<p class="MsoNormal"><a href="mailto:omniprof@gmail.com" class="moz-txt-link-freetext" target="_blank">omniprof@gmail.com</a><br data-mce-bogus="1"></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
</div>
</blockquote><br></blockquote></div></div></body></html>