-
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-4933 S1068 add support for lombok class annotations (#4763)
- Loading branch information
1 parent
896bda7
commit 5770bbb
Showing
5 changed files
with
65 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
"ruleKey": "S1068", | ||
"hasTruePositives": true, | ||
"falseNegatives": 0, | ||
"falsePositives": 0 | ||
"falsePositives": 4 | ||
} |
37 changes: 37 additions & 0 deletions
37
java-checks-test-sources/default/src/main/java/checks/unused/UnusedPrivateFieldLombok.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.unused; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
public class UnusedPrivateFieldLombok { | ||
|
||
@Data | ||
class LombokDataClass { | ||
private String data; // Compliant | ||
public class InnerClass { | ||
private String innerData; // Noncompliant | ||
private String usedData; // Compliant | ||
} | ||
void foo(){ | ||
var s = new InnerClass().usedData; | ||
} | ||
} | ||
|
||
@Getter | ||
class LombokGetterClass{ | ||
private String data; // Compliant | ||
} | ||
|
||
@Setter | ||
class LombokSetterClass{ | ||
private String data; // Compliant | ||
} | ||
|
||
@AllArgsConstructor | ||
class AllArgsConstructorClass { | ||
private String data; // Compliant | ||
} | ||
|
||
} |
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