-
Enhancement
-
Resolution: Fixed
-
P4
-
11, 13, 15
-
b16
ADDITIONAL SYSTEM INFORMATION :
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33-Ubuntu-1)
A DESCRIPTION OF THE PROBLEM :
Normally, when a computation with a long and a double variable is performed then javac produces an incompatible types error as illustrate in the following example:
long a = 1L + 0.1 * 3L; // produces error: incompatible types: possible lossy conversion from double to long
However, when the same computation is done with an "+=" operator (or also with similar operators, like "-="), then this error does not occur:
long b = 1L;
b += 0.1 * 3L;
Since this error is helpful to detect unwanted usages of variables or etc., it would be good to show it in all situations, where it can occur.
FREQUENCY : always
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33-Ubuntu-1)
A DESCRIPTION OF THE PROBLEM :
Normally, when a computation with a long and a double variable is performed then javac produces an incompatible types error as illustrate in the following example:
long a = 1L + 0.1 * 3L; // produces error: incompatible types: possible lossy conversion from double to long
However, when the same computation is done with an "+=" operator (or also with similar operators, like "-="), then this error does not occur:
long b = 1L;
b += 0.1 * 3L;
Since this error is helpful to detect unwanted usages of variables or etc., it would be good to show it in all situations, where it can occur.
FREQUENCY : always
- csr for
-
JDK-8286377 Add javac lint warning for possibly lossy conversion in compound assignments
- Closed
- relates to
-
JDK-8286378 Address possibly lossy conversions in java.base
- Resolved
-
JDK-8300591 @SuppressWarnings option "lossy-conversions" missing from jdk.compiler module javadoc
- Resolved
-
JDK-8286374 Address possibly lossy conversion in compound assignments in the JDK (umbrella)
- Open
(1 links to)