Java: Exclude @VisibleForTesting-to-@VisibleForTesting access from VisibleForTestingAbuse alerts

This commit is contained in:
Napalys Klicius
2025-08-06 14:57:16 +02:00
parent e4042402bc
commit 225723bfeb
3 changed files with 19 additions and 16 deletions

View File

@@ -1,11 +1,3 @@
| packageone/SourcePackage1.java:9:21:9:32 | Annotated.m1 | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:9:29:9:30 | m1 | element |
| packageone/SourcePackage1.java:10:21:10:32 | Annotated.m2 | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:11:26:11:27 | m2 | element |
| packageone/SourcePackage1.java:12:18:12:36 | fPublic(...) | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:26:23:26:29 | fPublic | element |
| packageone/SourcePackage1.java:13:18:13:39 | fProtected(...) | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:31:26:31:35 | fProtected | element |
| packageone/SourcePackage1.java:16:31:16:42 | Annotated.m1 | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:9:29:9:30 | m1 | element |
| packageone/SourcePackage1.java:17:31:17:42 | Annotated.m2 | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:11:26:11:27 | m2 | element |
| packageone/SourcePackage1.java:18:28:18:46 | fPublic(...) | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:26:23:26:29 | fPublic | element |
| packageone/SourcePackage1.java:19:28:19:49 | fProtected(...) | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:31:26:31:35 | fProtected | element |
| packageone/SourcePackage.java:9:21:9:32 | Annotated.m1 | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:9:29:9:30 | m1 | element |
| packageone/SourcePackage.java:10:21:10:32 | Annotated.m2 | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:11:26:11:27 | m2 | element |
| packageone/SourcePackage.java:16:18:16:36 | fPublic(...) | Access of $@ annotated with VisibleForTesting found in production code. | packagetwo/Annotated.java:26:23:26:29 | fPublic | element |

View File

@@ -6,17 +6,17 @@ public class SourcePackage1 extends Annotated {
@VisibleForTesting
public void f() {
String s1 = Annotated.m1; // $ SPURIOUS: Alert
String s2 = Annotated.m2; // $ SPURIOUS: Alert
String s1 = Annotated.m1;
String s2 = Annotated.m2;
int i2 = Annotated.fPublic(); // $ SPURIOUS: Alert
int i3 = Annotated.fProtected(); // $ SPURIOUS: Alert
int i2 = Annotated.fPublic();
int i3 = Annotated.fProtected();
Runnable lambda = () -> {
String lambdaS1 = Annotated.m1; // $ SPURIOUS: Alert
String lambdaS2 = Annotated.m2; // $ SPURIOUS: Alert
int lambdaI2 = Annotated.fPublic(); // $ SPURIOUS: Alert
int lambdaI3 = Annotated.fProtected(); // $ SPURIOUS: Alert
String lambdaS1 = Annotated.m1;
String lambdaS2 = Annotated.m2;
int lambdaI2 = Annotated.fPublic();
int lambdaI3 = Annotated.fProtected();
};
}
}