<div dir="auto"><a href="https://github.com/kzn/colt/blob/master/src%2Fcern%2Fcolt%2Fmatrix%2Flinalg%2FSeqBlas.java#L33">https://github.com/kzn/colt/blob/master/src%2Fcern%2Fcolt%2Fmatrix%2Flinalg%2FSeqBlas.java#L33</a>. <div dir="auto"><br></div><div dir="auto">Missed a link on that last one</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Jan 23, 2026, 10:29 AM Ethan McCue <<a href="mailto:ethan@mccue.dev">ethan@mccue.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">To add a concrete example, here is a Java collections library written by CERN<div dir="auto"><br></div><div dir="auto"><a href="https://github.com/kzn/colt" target="_blank" rel="noreferrer">https://github.com/kzn/colt</a></div><div dir="auto"><br></div><div dir="auto">They make instances of classes specifically to allow static methods to create aliases </div><div dir="auto"><br></div><div dir="auto"><a href="https://github.com/kzn/colt/blob/master/src%2Fhep%2Faida%2Fbin%2FBinFunctions1D.java#L12" target="_blank" rel="noreferrer">https://github.com/kzn/colt/blob/master/src%2Fhep%2Faida%2Fbin%2FBinFunctions1D.java#L12</a></div><div dir="auto"><br></div><div dir="auto">And this is done liberally throughout the library, as well as code which uses the library (which is reasonable to assume given that it was an intended usage pattern)</div><div dir="auto"><br></div><div dir="auto">private static final cern.jet.math.Functions F = cern.jet.math.Functions.functions;</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 23, 2026, 10:12 AM Red IO <<a href="mailto:redio.development@gmail.com" target="_blank" rel="noreferrer">redio.development@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I understand your idea. But I think that's exactly what the warning is for. It suggests people to not access static data through objects. Making it an hard error would likely break many code bases requiring massive migrations without any real benefits. </div><div dir="auto"><br></div><div dir="auto">Treating warnings as errors and annotating necessary warnings with suppress warnings and a comment should be best practice anyway. </div><div dir="auto"><br></div><div dir="auto">Great regards </div><div dir="auto">RedIODev <br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Fri, Jan 23, 2026, 13:42 Amazing Code <<a href="mailto:amazingcodewithus@gmail.com" rel="noreferrer noreferrer" target="_blank">amazingcodewithus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p>I am writing to propose a language enhancement regarding the handling of static member access in Java.</p><h2><strong>Issue</strong></h2><p>Java currently permits static fields and methods to be accessed through object references, despite static members belonging strictly to the class. This behavior is often misleading and can create confusion, especially in large codebases or among less-experienced developers.</p><p>Example:</p><pre><div><div><div><div></div></div></div><div dir="ltr"><code>MyClass obj = new MyClass();
obj.staticMethod();   // Currently allowed, but confusing
</code></div></div></pre><h2><strong>Proposed Enhancement</strong></h2><p>I request consideration of a change that <strong>disallows access to static members via object references</strong>, enforcing access exclusively through the class name. This would convert the current warning into a <strong>compile-time error</strong>.</p><h2><strong>Rationale</strong></h2><ul><li style="margin-left:15px"><p>Prevents misconceptions about instance vs. class-level behavior</p></li><li style="margin-left:15px"><p>Improves code clarity and consistency</p></li><li style="margin-left:15px"><p>Reduces maintenance complexity in enterprise applications</p></li><li style="margin-left:15px"><p>Encourages best practices already recommended by the community</p></li></ul><h2><strong>Suggested Requirements</strong></h2><ol><li style="margin-left:15px"><p>Compiler should produce an error when static members are accessed through object references.</p></li><li style="margin-left:15px"><p>Error messages should explicitly guide developers to use class-based access.</p></li><li style="margin-left:15px"><p>Rules should apply to static fields, static methods, and static nested types.</p></li><li style="margin-left:15px"><p>Optionally, provide a compiler flag for backward compatibility during migration.</p></li></ol><h2><strong>Conclusion</strong></h2><p>Restricting object-based access to static members would strengthen language clarity and help eliminate a common source of misunderstanding. I kindly request your consideration of this enhancement for future Java releases.</p><p>Thank you for your time and continued work on the Java platform.</p><p>Sincerely,<br><b>Kamlesh Kohli</b></p></div>
</blockquote></div></div></div>
</blockquote></div>
</blockquote></div>