On Tue, 7 Jun 2022 11:11:24 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> I think it wouldn't make any difference calling static methods via an 
>> instance variable or directly with class name.
>
> Yes, the same method would be called. Yet the difference is in the semantics: 
> the instance variable isn't used when calling a static method, it can be null 
> and it doesn't throw NullPointerException in this case.
> 
> The IDE raises a warning for such a usage. _You should use class name when 
> calling static methods._ It's just cleaner: the reader would see right away 
> it's a static method (without relying on the IDE syntax highlighting) rather 
> than an instance method.
> 
> Please revert these two lines to using the class name to call the static 
> methods.

Yeah sure, updated.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8721

Reply via email to