<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>I've filled:</p>
<p><a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8338301">https://bugs.openjdk.org/browse/JDK-8338301</a></p>
<p><br>
</p>
<p>Thanks,</p>
<p> Jan</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 13. 08. 24 13:06, Magnus Ihse Bursie
wrote:<br>
</div>
<blockquote type="cite" cite="mid:2ab7d346-3176-4e46-839e-c922a1f1708a@oracle.com">
<p>If this is something that should be fixed, do we have a JBS
issue tracking it?</p>
<p>/Magnus<br>
</p>
<div class="moz-cite-prefix">On 2024-07-30 19:43, Jonathan Gibbons
wrote:<br>
</div>
<blockquote type="cite" cite="mid:695aa99d-84cb-4329-8687-708f630cd2c8@oracle.com">
<p>Even without special-casing `main`, the error message is
misleading because it says `class, interface, enum, or record
expected` and does not admit the possibility of `void` in this
particular circumstance.</p>
<p>-- Jon</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 7/30/24 9:57 AM, Remi Forax
wrote:<br>
</div>
<blockquote type="cite" cite="mid:307277874.15318487.1722358635456.JavaMail.zimbra@univ-eiffel.fr">
<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" <a class="moz-txt-link-rfc2396E" href="mailto:jai.forums2013@gmail.com" moz-do-not-send="true"><jai.forums2013@gmail.com></a><br>
<b>To: </b>"jdk-dev" <a class="moz-txt-link-rfc2396E" href="mailto:jdk-dev@openjdk.org" moz-do-not-send="true"><jdk-dev@openjdk.org></a><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 moz-txt-link-freetext" href="mailto:omniprof@gmail.com" target="_blank" moz-do-not-send="true">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"><a class="moz-txt-link-freetext" href="C:\dev\Onramptesting\OnRamptest\src">C:\dev\Onramptesting\OnRamptest\src</a>>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"><a class="moz-txt-link-freetext" href="C:\dev\Onramptesting\OnRamptest\src">C:\dev\Onramptesting\OnRamptest\src</a>>javac
--enable-preview --source 23 -Xlint:preview
Main.java</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><a class="moz-txt-link-freetext" href="Main.java:1">Main.java:1</a>: 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"><a class="moz-txt-link-freetext" href="Main.java:3">Main.java:3</a>: error: class,
interface, enum, or record expected</p>
<p class="MsoNormal">main() {</p>
<p class="MsoNormal">^</p>
<p class="MsoNormal"><a class="moz-txt-link-freetext" href="Main.java:5">Main.java:5</a>: 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" moz-do-not-send="true">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>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>