On Wed, 4 Aug 2021 12:43:43 GMT, Chris Hegarty <che...@openjdk.org> wrote:

>> src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java line 
>> 69:
>> 
>>> 67: 
>>> 68:     public String toString() {
>>> 69:         final var sb = new 
>>> StringBuilder(HttpConnection.class.getSimpleName());
>> 
>> Why not simplify into `new StringBuilder(getClass().getSimpleName());` ?
>
> Have a marginal preference for HttpConnection.class.getSimpleName(), since it 
> is a constant, but don't object to getClass().

Right - but then why not use a string literal? If you're going to call a method 
to get the class name then I assume you want to get the actual concrete class 
name... I don't have much objection either way - especially since I suspect 
there are no subclasses anyway...

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

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

Reply via email to