Inspectopedia
 
2024.3

Integer multiplication or shift implicitly cast to 'long'

Warning
New
Last modified: 03 December 2024

Reports integer multiplications and left shifts that are implicitly cast to long.

Example:

After the quick-fix is applied, the code changes to:

Example:

After the quick-fix is applied, the code changes to:

Such multiplications are often a mistake, as overflow truncation may occur unexpectedly. Converting an int literal to a long literal (65536L) fixes the problem.