-
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-5080 S1659: Quickfix breaks syntax when multiple arrays are…
… declared
- Loading branch information
1 parent
3acc73e
commit 2d5d294
Showing
5 changed files
with
69 additions
and
11 deletions.
There are no files selected for viewing
24 changes: 21 additions & 3 deletions
24
java-checks-test-sources/default/src/main/java/checks/OneDeclarationPerLineCheckSample.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 |
---|---|---|
@@ -1,11 +1,29 @@ | ||
package checks; | ||
|
||
import java.util.Collections; | ||
|
||
class OneDeclarationPerLineCheckSample { | ||
|
||
int i = 0, j[] = null, k[][] = new int[0][0]; // Noncompliant [[quickfixes=qf_indentation1]] | ||
// ^ | ||
// fix@qf_indentation1 {{Declare on separated lines}} | ||
// edit@qf_indentation1 [[sc=12;ec=17]] {{;\n int[] j }} | ||
// edit@qf_indentation1 [[sc=24;ec=31]] {{;\n int[][] k }} | ||
|
||
int one, two; // Noncompliant | ||
// ^^^ | ||
|
||
int no; int spaceBefore; // Noncompliant [[quickfixes=qf_indentation2]] | ||
// ^^^^^^^^^^^ | ||
// ^^^^^^^^^^^ | ||
// fix@qf_indentation2 {{Declare on separated lines}} | ||
// edit@qf_indentation2 [[sc=10;ec=11]] {{\n }} | ||
|
||
int arr1[] = null, arr2[] = null; // Noncompliant [[quickfixes=qf_indentation3]] | ||
// ^^^^ | ||
// fix@qf_indentation3 {{Declare on separated lines}} | ||
// edit@qf_indentation3 [[sc=20;ec=28]] {{;\n int[] arr2 }} | ||
|
||
public int three, four; // Noncompliant [[quickfixes=qf_indentation4]] | ||
// ^^^^ | ||
// fix@qf_indentation4 {{Declare on separated lines}} | ||
// edit@qf_indentation4 [[sc=19;ec=21]] {{;\n public int }} | ||
|
||
} |
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
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