Redundant Math.min call in Http2ClientImpl#getConnectionWindowSize

Michael McMahon michael.x.mcmahon at oracle.com
Fri Aug 27 08:10:26 UTC 2021


Thanks. I have filed https://bugs.openjdk.java.net/browse/JDK-8273059 to 
track this.

- Michael.

On 19/08/2021 19:50, Andrey Turbanov wrote:
> Hello.
>
> During investigation of results of IDEA inspections I found a
> redundant call to Math.min in a method
> jdk.internal.net.http.Http2ClientImpl#getConnectionWindowSize
> https://github.com/openjdk/jdk/blob/master/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java#L240
>
> int defaultValue = Math.min(Integer.MAX_VALUE,
>          Math.max(streamWindow, K*K*32));
>
> Call of method Math.min(int, int) is redundant if one of parameters is
> known to be Integer.MAX_VALUE (or Integer.MIN_VALUE)
>
>
>
> Andrey Turbanov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20210827/49175c20/attachment-0001.htm>


More information about the net-dev mailing list