RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]
Pavel Rappo
prappo at openjdk.java.net
Thu May 12 11:34:59 UTC 2022
On Thu, 12 May 2022 10:08:23 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> src/java.net.http/share/classes/jdk/internal/net/http/websocket/Frame.java line 291:
>>
>>> 289:
>>> 290: HeaderWriter noMask() {
>>> 291: // The negation "~" sets the high order bits
>>
>> Rubber-stamping this in front of every of the four closely sitting casts seems excessive:
>>
>> // The negation "~" sets the high order bits
>> // so the value is more than 16 bits and the
>> // compiler will emit a warning if not cast
>
> I don't disagree. I had the same feeling. But I don't necessarily read a file from top to bottom - and someone just glancing at one of these methods might wonder why one line has the cast and the other hasn't.
Readers should always consider as much of the context as practical; but I like your solution.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8656
More information about the net-dev
mailing list