-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONARJAVA-1755 Add parameter to only target long (#908)
* SONARJAVA-1755 Add parameter to only target long * Remove link to deprecated rule
- Loading branch information
Showing
4 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
java-checks/src/test/files/checks/UppercaseSuffixesCheckOnlyLong.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class A { | ||
double f = 1.; | ||
long long1 = 1l; // Noncompliant [[sc=16;ec=18]] {{Upper-case this literal "l" suffix.}} | ||
float float1 = 1.0f; // Compliant | ||
double double1 = 1.0d; // Compliant | ||
|
||
private void test () { | ||
|
||
long retVal = (bytes[0] & 0xFF); | ||
for (int i = 1; i < Math.min(bytes.length, 8); i++) { | ||
retVal |= (bytes[i] & 0xFFL) << (i * 8); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters