<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Received on the -comments list.<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">Begin forwarded message:</div>
<br class="Apple-interchange-newline">
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class="">
<span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">From:
</b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Abdurasul Abduraimov <<a href="mailto:abdurasulabduraimov22@gmail.com" class="">abdurasulabduraimov22@gmail.com</a>><br class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class="">
<span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Subject:
</b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">Suggestion regarding Null State Analysis in Project Valhalla</b><br class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class="">
<span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Date:
</b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">June 12, 2025 at 1:06:49 AM EDT<br class="">
</span></div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class="">
<span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">To:
</b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><a href="mailto:valhalla-spec-comments@openjdk.org" class="">valhalla-spec-comments@openjdk.org</a><br class="">
</span></div>
<br class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<p class="">Dear Team,</p>
<p class="">I am a big fan of Java and I’m eagerly awaiting the release of Project Valhalla. I watched the Valhalla session from IntelliJ IDEA Conf 2025 (Day 1), where Rémi Forax discussed the "Null State Analysis" feature. As he explained, the system defines
 three null states:</p>
<ol class="">
<li class="">
<p class=""><strong class="">Null-restricted:</strong> <code class="">Integer!</code> or
<code class="">String!</code></p>
</li><li class="">
<p class=""><strong class="">Nullable:</strong> <code class="">Integer?</code> or
<code class="">String?</code></p>
</li><li class="">
<p class=""><strong class="">Unspecified:</strong> <code class="">Integer</code> or
<code class="">String</code> (with no warning)</p>
</li></ol>
<p class="">I understand that due to Java’s large amount of legacy code, introducing nullable and non-nullable types (as in Kotlin) is challenging, and the team is prioritizing backward compatibility.</p>
<p class="">However, I’d like to propose an idea:<br class="">
What if the <em class="">Unspecified</em> state also emitted a warning? This way, all types would continue to be effectively nullable (as they are today), but developers upgrading to future Java versions (where Valhalla is finalized) would be encouraged to
 explicitly annotate their types. They could mark types as <em class="">not-null</em> where appropriate, or accept the nullable default, making their intentions clear.</p>
<p class="">This would parallel Kotlin’s philosophy, but in an inverse way:</p>
<ul class="">
<li class="">
<p class="">In Kotlin: all types are <em class="">not-null</em> by default, nullable types must be explicitly declared.</p>
</li><li class="">
<p class="">In Java (with this proposal): all types would be <em class="">nullable</em> by default, but
<em class="">not-null</em> types would be explicitly declared — with the added benefit of a warning to help modernize existing code.</p>
</li></ul>
<p class="">I know it’s a bit unusual, but I believe this approach could strike a balance between safety, clarity, and backward compatibility.</p>
<p class="">Thank you for your great work on Java!</p>
<p class="">Best regards,<br class="">
Abdurasul Abduraimov</p>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>