RFR: 8275079: Remove unnecessary conversion to String in java.net.http

Weijun Wang weijun at openjdk.java.net
Mon Oct 11 20:47:14 UTC 2021


On Sat, 2 Oct 2021 20:05:37 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:

> Cleanup unnecessary String.valueOf calls (and similar) when conversion will happen implicitly anyway

Some small comments.

src/java.net.http/share/classes/jdk/internal/net/http/Http1AsyncReceiver.java line 738:

> 736:             if (flowTag != null) {
> 737:                 dbgTag = tag = "Http1AsyncReceiver("+ flowTag + ")";
> 738:             } else {

If the only use of `flowTag` is `flow` in string, it looks like `flow` is enough. i.e.


if (flow != null) {
    dbgTag = tag = "Http1AsyncReceiver("+ flow + ")";
}

src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java line 831:

> 829:         @Override
> 830:         public String toString() {
> 831:             return super.toString() + "/parser=" + parser;

Can we use `super` instead of `super.toString()`?

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

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


More information about the security-dev mailing list