On Thu, 30 Jul 2026 07:25:35 GMT, Jaikiran Pai <[email protected]> wrote:
>> they were flagged by IntelliJ as dead code; `handshaking` is always false. >> It is initialized to `false` at the beginning of the `while` loop, and only >> set to `true` immediately before `continue` or `break` (i. e. just before >> being reset back to `false` or going out of scope). >> >> I also tried changing this to `if (!complete)`, but that resulted in test >> failures. > > You are indeed right, this `if` block is dead code in its current form. I had > a look at the history of this code and it looks like the `if` block ended up > being dead code since the change in > https://bugs.openjdk.org/browse/JDK-8204679. > > However, this (dead code) was also updated through > https://bugs.openjdk.org/browse/JDK-8231449 and that > https://github.com/openjdk/jdk/commit/ecde34ee359b42bce7670cef3915a87fb8406bca > introduced the call to `requestMoreDataIfNeeded();` in that `if` block. > > In its current form of course this code never executes, so it's OK to remove > it. Separately we might have to understand if anything else needs to be done > here. I believe the fix was to add `requestMoreDataIfNeeded()` before any `return` statement - except where the method returned in case of errors. So if the `return` was dead code and is removed then removing the `requestMoreDataIfNeeded()` that was added before it should be OK too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32089#discussion_r3689996825
