RFR: 8244681: Add a warning for possibly lossy conversion in compound assignments
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions. The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable. The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments. Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments. Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks. Thanks for your review, Adam ------------- Commit messages: - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments - 8244681: Add a warning for possibly lossy conversion in compound assignments Changes: https://git.openjdk.java.net/jdk/pull/8599/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8244681 Stats: 449 lines in 26 files changed: 444 ins; 0 del; 5 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
On Mon, 9 May 2022 15:56:35 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Build changes look good. ------------- Marked as reviewed by erikj (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/8599
On Mon, 9 May 2022 15:56:35 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Marked as reviewed by prr (Reviewer). test/langtools/tools/javac/lint/LossyConversions.java line 131:
129: @SuppressWarnings("lossy-conversions") 130: public void supressedLossyConversions() { 131: byte a = 0;
you might want to spell suppressed correctly. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Mon, 9 May 2022 15:56:35 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
I see there is already a bug filed to address situations found by the new warning in the JDK's libraries (JDK-8286374). As a matter of policy, I recommend the (potential) warnings be addressed in at least the java.base and java.desktop modules before the new warning is enabled. In other words, a priority should be given to keeping java.base and java.desktop compiling successfully with all warnings enabled. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Mon, 9 May 2022 15:56:35 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
I agree with the priority to keep java.base and java.desktop clean from possibly lossy conversions, so the related issues should probably raise from P4 priority level. However this lint warning as a part of the javac is critical to confirm that the situations have been correctly addressed. If we want to avoid "blind" patching, we only two possible scenarios: 1. big homogenous patch including hundreds of fixed lines of code across many "moving-target" classes, together with lint warning implemented and enabled 2. javac lint patch (disabled for affected JDK modules build) goes first, so each case can be resolved, reviewed and validated in individual patch
From complexity and cost perspective I prefer the second scenario.
------------- PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning wording fixed typo in test method name ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8599/files - new: https://git.openjdk.java.net/jdk/pull/8599/files/47779ba5..6b3942b8 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=00-01 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
On Tue, 10 May 2022 09:07:44 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning wording fixed typo in test method name
src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties line 210:
208: 209: javac.opt.Xlint.desc.lossy-conversions=\ 210: Warn about compiler possible lossy conversions.
I like this warning. But the documentation doesn't even parse as English. I suggest this, as more grammatical and precise:
Warn about possible lossy conversions in compound assignments
------------- PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8599/files - new: https://git.openjdk.java.net/jdk/pull/8599/files/6b3942b8..f0729396 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 07:45:39 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description
Lossy conversion issues for jdk.jfr and jdk.management.jfr. have been fixed. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 07:45:39 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description
Check updates on JDK-8286374 subtasks. make/modules/jdk.jfr/Java.gmk line 26:
24: # 25: 26: DISABLED_WARNINGS_java += exports lossy-conversions
Note that with the fix of JDK-8286392 (and JDK-8286396) the `lossy-conversions` warning should not be disabled for the JFR code. In general, you need to check which of the subtasks of JDK-8286374 that has been fixed, and adjust the makefiles accordingly, before pushing this fix. (In the future, it might be easier to push the fix which disables the warnings first, and then file follow-up bugs on aa per-component basis, and remind them to remove the disabling in the makefile. That way there won't be a race between individual fixes and a "master" bug like this.) ------------- Changes requested by ihse (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 12:59:49 GMT, Magnus Ihse Bursie <ihse@openjdk.org> wrote:
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description
make/modules/jdk.jfr/Java.gmk line 26:
24: # 25: 26: DISABLED_WARNINGS_java += exports lossy-conversions
Note that with the fix of JDK-8286392 (and JDK-8286396) the `lossy-conversions` warning should not be disabled for the JFR code.
In general, you need to check which of the subtasks of JDK-8286374 that has been fixed, and adjust the makefiles accordingly, before pushing this fix.
(In the future, it might be easier to push the fix which disables the warnings first, and then file follow-up bugs on aa per-component basis, and remind them to remove the disabling in the makefile. That way there won't be a race between individual fixes and a "master" bug like this.)
I agree, but if it doesn't happen, I can follow up with a separate PR where I remove the disablement. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 13:05:45 GMT, Erik Gahlin <egahlin@openjdk.org> wrote:
make/modules/jdk.jfr/Java.gmk line 26:
24: # 25: 26: DISABLED_WARNINGS_java += exports lossy-conversions
Note that with the fix of JDK-8286392 (and JDK-8286396) the `lossy-conversions` warning should not be disabled for the JFR code.
In general, you need to check which of the subtasks of JDK-8286374 that has been fixed, and adjust the makefiles accordingly, before pushing this fix.
(In the future, it might be easier to push the fix which disables the warnings first, and then file follow-up bugs on aa per-component basis, and remind them to remove the disabling in the makefile. That way there won't be a race between individual fixes and a "master" bug like this.)
I agree, but if it doesn't happen, I can follow up with a separate PR where I remove the disablement.
That's good to know. I think the tricky part is mostly about keeping track of all these disabled warnings, so they are not kept around longer than necessary. And that needs coordination with all the subtasks of the umbrella issue. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 13:10:10 GMT, Magnus Ihse Bursie <ihse@openjdk.org> wrote:
I agree, but if it doesn't happen, I can follow up with a separate PR where I remove the disablement.
That's good to know. I think the tricky part is mostly about keeping track of all these disabled warnings, so they are not kept around longer than necessary. And that needs coordination with all the subtasks of the umbrella issue.
Thanks for quick reaction. I'll keep my eyes on this race of patches and update this pull request accordingly or create a new PR. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 13:27:38 GMT, Adam Sotona <asotona@openjdk.org> wrote:
That's good to know. I think the tricky part is mostly about keeping track of all these disabled warnings, so they are not kept around longer than necessary. And that needs coordination with all the subtasks of the umbrella issue.
Thanks for quick reaction. I'll keep my eyes on this race of patches and update this pull request accordingly or create a new PR.
I put out a PR for java.base, but thought I'd wait until the javac fixe were pushed before integrating and would re-enable the warnings at the same time. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
On Wed, 11 May 2022 13:31:16 GMT, Roger Riggs <rriggs@openjdk.org> wrote:
Thanks for quick reaction. I'll keep my eyes on this race of patches and update this pull request accordingly or create a new PR.
I put out a PR for java.base, but thought I'd wait until the javac fixe were pushed before integrating and would re-enable the warnings at the same time.
Feel free to go ahead with the java.base PR as this one still needs CSR. ------------- PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning wording fixed typo in test method name - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments jdk.internal.le make patch to disable warnings - 8244681: Add a warning for possibly lossy conversion in compound assignments ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8599/files - new: https://git.openjdk.java.net/jdk/pull/8599/files/f0729396..a59dfa4f Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=03 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=02-03 Stats: 9179 lines in 255 files changed: 5253 ins; 2422 del; 1504 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: enabled lossy-conversions warnings for jdk.jfr and jdk.management.jfr ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8599/files - new: https://git.openjdk.java.net/jdk/pull/8599/files/a59dfa4f..32282515 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=04 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=03-04 Stats: 2 lines in 2 files changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits: - lossy conversions addressed in java.net.http, jdk.incubator.foreign, Microbenchmarks and most of java.base new case appeared in java.base by moving jdk.incubator.foreign code under java.base - Merge remote-tracking branch 'upstream/master' into JDK-8244681 # Conflicts: # make/test/BuildMicrobenchmark.gmk - enabled lossy-conversions warnings for jdk.jfr and jdk.management.jfr - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning wording fixed typo in test method name - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments jdk.internal.le make patch to disable warnings - 8244681: Add a warning for possibly lossy conversion in compound assignments ------------- Changes: https://git.openjdk.java.net/jdk/pull/8599/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=05 Stats: 444 lines in 21 files changed: 441 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits: - Merge branch 'openjdk:master' into JDK-8244681 - lossy conversions addressed in java.net.http, jdk.incubator.foreign, Microbenchmarks and most of java.base new case appeared in java.base by moving jdk.incubator.foreign code under java.base - Merge remote-tracking branch 'upstream/master' into JDK-8244681 # Conflicts: # make/test/BuildMicrobenchmark.gmk - enabled lossy-conversions warnings for jdk.jfr and jdk.management.jfr - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning wording fixed typo in test method name - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments jdk.internal.le make patch to disable warnings - 8244681: Add a warning for possibly lossy conversion in compound assignments ------------- Changes: https://git.openjdk.java.net/jdk/pull/8599/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=06 Stats: 444 lines in 21 files changed: 441 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8599/files - new: https://git.openjdk.java.net/jdk/pull/8599/files/a72644e9..74f9f4b1 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=07 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=06-07 Stats: 3 lines in 3 files changed: 0 ins; 3 del; 0 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits: - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - Merge branch 'openjdk:master' into JDK-8244681 - lossy conversions addressed in java.net.http, jdk.incubator.foreign, Microbenchmarks and most of java.base new case appeared in java.base by moving jdk.incubator.foreign code under java.base - Merge remote-tracking branch 'upstream/master' into JDK-8244681 # Conflicts: # make/test/BuildMicrobenchmark.gmk - enabled lossy-conversions warnings for jdk.jfr and jdk.management.jfr - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning description - 8244681: Add a warning for possibly lossy conversion in compound assignments recommended correction of the warning wording fixed typo in test method name - Merge branch 'openjdk:master' into JDK-8244681 - ... and 2 more: https://git.openjdk.java.net/jdk/compare/c9065915...455720ef ------------- Changes: https://git.openjdk.java.net/jdk/pull/8599/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=08 Stats: 441 lines in 18 files changed: 438 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with two additional commits since the last revision: - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/8599/files - new: https://git.openjdk.java.net/jdk/pull/8599/files/455720ef..4978c2a6 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=09 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8599&range=08-09 Stats: 5 lines in 3 files changed: 3 ins; 1 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.java.net/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits: - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - Merge branch 'openjdk:master' into JDK-8244681 - lossy conversions addressed in java.net.http, jdk.incubator.foreign, Microbenchmarks and most of java.base new case appeared in java.base by moving jdk.incubator.foreign code under java.base - Merge remote-tracking branch 'upstream/master' into JDK-8244681 # Conflicts: # make/test/BuildMicrobenchmark.gmk - enabled lossy-conversions warnings for jdk.jfr and jdk.management.jfr - Merge branch 'openjdk:master' into JDK-8244681 - ... and 5 more: https://git.openjdk.org/jdk/compare/cf4a4966...3314423d ------------- Changes: https://git.openjdk.org/jdk/pull/8599/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=10 Stats: 442 lines in 17 files changed: 440 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits: - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - Merge branch 'openjdk:master' into JDK-8244681 - lossy conversions addressed in java.net.http, jdk.incubator.foreign, Microbenchmarks and most of java.base new case appeared in java.base by moving jdk.incubator.foreign code under java.base - Merge remote-tracking branch 'upstream/master' into JDK-8244681 # Conflicts: # make/test/BuildMicrobenchmark.gmk - enabled lossy-conversions warnings for jdk.jfr and jdk.management.jfr - ... and 6 more: https://git.openjdk.org/jdk/compare/e7d52e25...1b2d663d ------------- Changes: https://git.openjdk.org/jdk/pull/8599/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=11 Stats: 442 lines in 17 files changed: 440 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits: - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - Merge branch 'openjdk:master' into JDK-8244681 - lossy conversions addressed in java.net.http, jdk.incubator.foreign, Microbenchmarks and most of java.base new case appeared in java.base by moving jdk.incubator.foreign code under java.base - Merge remote-tracking branch 'upstream/master' into JDK-8244681 # Conflicts: # make/test/BuildMicrobenchmark.gmk - ... and 7 more: https://git.openjdk.org/jdk/compare/7905788e...cab6ce59 ------------- Changes: https://git.openjdk.org/jdk/pull/8599/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=12 Stats: 442 lines in 17 files changed: 440 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: re-enabled lossy conversions warnings for java.security.jgss, jdk.crypto.ec and jdk.internal.le ------------- Changes: - all: https://git.openjdk.org/jdk/pull/8599/files - new: https://git.openjdk.org/jdk/pull/8599/files/cab6ce59..6f32938d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=13 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=12-13 Stats: 3 lines in 3 files changed: 0 ins; 3 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
On Mon, 27 Jun 2022 09:25:58 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
re-enabled lossy conversions warnings for java.security.jgss, jdk.crypto.ec and jdk.internal.le
ping to keep the PR open ------------- PR: https://git.openjdk.org/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 19 commits: - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy conversions warnings for java.security.jgss, jdk.crypto.ec and jdk.internal.le - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - Merge branch 'openjdk:master' into JDK-8244681 - ... and 9 more: https://git.openjdk.org/jdk/compare/6a1e98cb...4a7ce942 ------------- Changes: https://git.openjdk.org/jdk/pull/8599/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=14 Stats: 439 lines in 14 files changed: 437 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 20 commits: - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy conversions warnings for java.security.jgss, jdk.crypto.ec and jdk.internal.le - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - ... and 10 more: https://git.openjdk.org/jdk/compare/7f3250d7...4b78b1c5 ------------- Changes: https://git.openjdk.org/jdk/pull/8599/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=15 Stats: 439 lines in 14 files changed: 437 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
On Wed, 14 Sep 2022 11:10:15 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 20 commits:
- Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy conversions warnings for java.security.jgss, jdk.crypto.ec and jdk.internal.le - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - Merge branch 'openjdk:master' into JDK-8244681 - re-enabled lossy-conversion javac warnings in JDK Build Tools and jdk.compiler module - Added man-page line about lossy-conversion lint - Merge branch 'openjdk:master' into JDK-8244681 - 8244681: Add a warning for possibly lossy conversion in compound assignments re-enabled warnings for java.base, java.rmi and java.smartcardio - ... and 10 more: https://git.openjdk.org/jdk/compare/7f3250d7...4b78b1c5
Please review also linked Release Note issue. Thanks, Adam ------------- PR: https://git.openjdk.org/jdk/pull/8599
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision: re-enabled lossy-conversions warnings for jdk.hotspot.agent ------------- Changes: - all: https://git.openjdk.org/jdk/pull/8599/files - new: https://git.openjdk.org/jdk/pull/8599/files/4b78b1c5..0b93c284 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=16 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=8599&range=15-16 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/8599.diff Fetch: git fetch https://git.openjdk.org/jdk pull/8599/head:pull/8599 PR: https://git.openjdk.org/jdk/pull/8599
On Mon, 9 May 2022 15:56:35 GMT, Adam Sotona <asotona@openjdk.org> wrote:
Please review this patch adding new lint option, **lossy-conversions**, to javac to warn about type casts in compound assignments with possible lossy conversions.
The new lint warning is shown if the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable.
The implementation of the warning is based on similar check performed to emit "possible lossy conversion" compilation error for simple assignments.
Proposed patch also include complex matrix-style test with positive and negative test cases of lossy conversions in compound assignments.
Proposed patch also disables this new lint option in all affected JDK modules and libraries to allow smooth JDK build. Individual cases to address possibly lossy conversions warnings in JDK are already addressed in a separate umbrella issue and its sub-tasks.
Thanks for your review, Adam
This pull request has now been integrated. Changeset: aff5ff14 Author: Adam Sotona <asotona@openjdk.org> URL: https://git.openjdk.org/jdk/commit/aff5ff14b208b3c2be93d7b4fab8b07c5be12f3e Stats: 438 lines in 13 files changed: 437 ins; 0 del; 1 mod 8244681: Add a warning for possibly lossy conversion in compound assignments 8293797: Release Note: Javac warns about type casts in compound assignments with possible lossy conversions Reviewed-by: erikj, prr ------------- PR: https://git.openjdk.org/jdk/pull/8599
participants (9)
-
Adam Sotona
-
Adam Sotona
-
Erik Gahlin
-
Erik Joelsson
-
Joe Darcy
-
John R Rose
-
Magnus Ihse Bursie
-
Phil Race
-
Roger Riggs