Long Literal With Lowercase Suffix
ID |
java.long_literal_uppercase_suffix |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Java |
Tags |
reliability |
Rationale
The lowercase letter l is easily confused with the digit 1 in most fonts, making code harder to read and increasing the risk of misunderstanding the value. For example, 10l can be misread as 101. Using the uppercase L eliminates this ambiguity.
// Bad -- lowercase l looks like 1
long timeout = 3000l;
long mask = 0xFFl;
Remediation
Replace the lowercase l suffix with the uppercase L.
// Good
long timeout = 3000L;
long mask = 0xFFL;