-
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-5116 S1105 sometimes falsely requests the curly brace to be…
… moved (#4874)
- Loading branch information
1 parent
1df6e7e
commit fa31182
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
java-checks-test-sources/default/src/main/java/checks/LeftCurlyBraceEndLineCheck_record.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,37 @@ | ||
package checks; | ||
|
||
record LeftCurlyBraceEndLineCheck_record(Integer value) { | ||
|
||
// Test https://sonarsource.atlassian.net/browse/SONARJAVA-5116 | ||
public LeftCurlyBraceEndLineCheck_record(String v) { // Compliant | ||
// but <- Complains about this curly brace | ||
this(Integer.parseInt(v)); | ||
} | ||
|
||
public static final String FOR_SOME_REASON_THIS_NEEDS_TO_EXIST_HERE_TO_REPRODUCE_ISSUE = "IDK"; | ||
public static final String FOR_SOME_REASON_THIS_NEEDS_TO_EXIST_HERE_TO_REPRODUCE_ISSUE_2 = "IDK"; | ||
|
||
} | ||
|
||
record TestRecordSyntaxV2(String value) { | ||
|
||
// Test https://sonarsource.atlassian.net/browse/SONARJAVA-5116 | ||
private void doThing() { // Compliant | ||
// but <- Complains about this curly brace | ||
new LeftCurlyBraceEndLineCheck_record("brace"); | ||
} | ||
|
||
public record ThisRecordCausesTheIssueAsWell(String value) { | ||
} | ||
|
||
} | ||
|
||
record TestRecordSyntaxV3(Integer value) | ||
{ // Noncompliant | ||
public TestRecordSyntaxV3(String v) | ||
{ // Noncompliant | ||
this(Integer.parseInt(v)); | ||
} | ||
public static final String CONST_1 = "IDK"; | ||
public static final String CONST_2 = "IDK"; | ||
} |
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