Back to Intellij Community

LossyConversionCompoundAssignment

java/java-impl/resources/inspectionDescriptions/LossyConversionCompoundAssignment.html

2025.3-rc-2361 B
Original Source

Reports compound assignments if the type of the right-hand operand is not assignment compatible with the type of the variable.

During such compound assignments, an implicit cast occurs, potentially resulting in lossy conversions.

Example:

long c = 1;
  c += 1.2;

After the quick-fix is applied:

long c = 1;
  c += (long) 1.2;

New in 2023.2