Incident Report 9079511: Java Language Enhancement: Disallow access to static members via object references

Remi Forax forax at univ-mlv.fr
Sat Jan 24 14:46:36 UTC 2026


> From: "Archie Cobbs" <archie.cobbs at gmail.com>
> To: "attila kelemen85" <attila.kelemen85 at gmail.com>
> Cc: "Amazing Code" <amazingcodewithus at gmail.com>, "amber-dev"
> <amber-dev at openjdk.org>
> Sent: Saturday, January 24, 2026 3:07:47 PM
> Subject: Re: Incident Report 9079511: Java Language Enhancement: Disallow access
> to static members via object references

> Funny you should mention that... :)

> In JDK 26+ you will be able to do this via flags like -Werror:static

> See [ https://bugs.openjdk.org/browse/JDK-8349847 |
> https://bugs.openjdk.org/browse/JDK-8349847 ] for details.

> -Archie

IDEs were able to do that since a long time, 
it was long overdue. 

Soon we will be able to turn those nullcheck warnings into errors. 

Thanks Archie. 

Rémi 

> On Sat, Jan 24, 2026 at 7:08 AM Attila Kelemen < [
> mailto:attila.kelemen85 at gmail.com | attila.kelemen85 at gmail.com ] > wrote:

>>> My $0.02: This is an easy call. The answer is that it's not worth changing
>>> because (b) this would cause legacy to to start failing to compile, which is
>>> violates Java's stellar reputation for backward compatibility, and (b) there is
>>> already a perfectly reasonable workaround, i.e. -Xlint:static -Werror .

>> I'm not arguing that the original request should be implemented and break
>> existing code (bad as they are). However, this suggestion doesn't really work,
>> because javac doesn't support different sets of values for `Werror` and for
>> mere warnings. That is, I usually want to turn on almost everything for `Xlint`
>> , but I definitely don't want every warning to be an error (most notably, I
>> don't want `@deprecated` to immediately fail compilation, but I want it to be
>> reported as a warning).

> --
> Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20260124/0da485fc/attachment.htm>


More information about the amber-dev mailing list