<div dir="ltr"><div dir="ltr"><p>Dear Team,</p>
<p>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>
<li>
<p><strong>Null-restricted:</strong> <code>Integer!</code> or <code>String!</code></p>
</li>
<li>
<p><strong>Nullable:</strong> <code>Integer?</code> or <code>String?</code></p>
</li>
<li>
<p><strong>Unspecified:</strong> <code>Integer</code> or <code>String</code> (with no warning)</p>
</li>
</ol>
<p>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>However, I’d like to propose an idea:<br>
What if the <em>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>not-null</em> where appropriate, or accept the nullable default, making their intentions clear.</p>
<p>This would parallel Kotlin’s philosophy, but in an inverse way:</p>
<ul>
<li>
<p>In Kotlin: all types are <em>not-null</em> by default, nullable types must be explicitly declared.</p>
</li>
<li>
<p>In Java (with this proposal): all types would be <em>nullable</em> by default, but <em>not-null</em> types would be explicitly declared — with the added benefit of a warning to help modernize existing code.</p>
</li>
</ul>
<p>I know it’s a bit unusual, but I believe this approach could strike a balance between safety, clarity, and backward compatibility.</p>
<p>Thank you for your great work on Java!</p>
<p>Best regards,<br>Abdurasul Abduraimov</p></div>
</div>