<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"var\(--block-font-family\)";}
@font-face
        {font-family:"var\(--body-font-family\)";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="FR" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal">I have a problem with JShell, I don’t know if it should go in this mailing list.<o:p></o:p></p>
<p class="MsoNormal">On JDK 21 (should be the same for any JDK version 9+), Windows 11, with this following code :<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<p class="MsoNormal">var jshell = JShell.create() ;<o:p></o:p></p>
<p class="MsoNormal">jshell.sourceCodeAnalysis().analyzeCompletion("println(").source() // null<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<p class="MsoNormal">this second line returns null, but the doc of SourceCodeAnalysis.CompletionInfo#source() says this:<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<div style="margin-right:7.5pt;margin-bottom:3.75pt;color:var(--block-text-color);font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px">
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"var\(--block-font-family\)"">Source code for the first Snippet of code input. For example, first statement, or first method declaration. Trailing semicolons will be added, as needed.<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-top:7.5pt"><b><span style="font-size:9.0pt;font-family:"var\(--body-font-family\)";color:#353833">Returns:<o:p></o:p></span></b></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:36.0pt">
<span style="font-size:10.5pt;font-family:"var\(--block-font-family\)";color:#353833">the source of the first encountered Snippet<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:0cm">
<span style="font-size:10.5pt;font-family:"var\(--block-font-family\)";color:#353833">```<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:0cm">
There is no mention that it can return null.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:0cm">
Yes it can makes sense to return null (well actually yesn’t since from what I’ve seen from the source code, it’s only null if it is incomplete, it’s not null even if it is unknown), since I gave an invalid snippet, but the doc should at least mention it.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:0cm">
<o:p> </o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:0cm">
Regards,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:3.75pt;margin-right:7.5pt;margin-bottom:7.5pt;margin-left:0cm">
Tom.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>