On Tue, 26 Jul 2022 22:03:29 GMT, Phil Race <p...@openjdk.org> wrote:
>> - replaced with exact functional equivalent (in the presence of exceptions, >> for example) > > This warning seems to be saying "the language has this feature that the > designers thought useful, but I don't like it so > I'm going to complain". > > I don't see the difference between > if (valid = res.validate(fctx)) { > and > if ((valid = res.validate(fctx)) == true) { > > in both cases we are using the value returned by the assignment and if > magically using it in ( X == true) instead of if (X) > makes the warning go away that is both artificial and clumsy. > > how does now it know you didn't mean > if ((valid == res.validate(fctx)) == true) { > > So I'd not make these changes. If someone (else) does then agree with them > at least fix "if(" -> "if (" I agree with @prrace that the proposed changes don't add any value, since the conditional expression still contains an assignment. If this is to be done at all, I suggest to simply move the assignment out of the conditional, and test the assigned value: // old: if(isSame = fname.equals(container.fname)) { // new: isSame = fname.equals(container.fname); if (isSame) { ------------- PR: https://git.openjdk.org/jfx/pull/851