On Tue, 10 May 2022 09:07:44 GMT, Adam Sotona <asot...@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

Reply via email to