Java: Added inline test expectations for java/visible-for-testing-abuse

This commit is contained in:
Napalys Klicius
2025-08-06 11:23:02 +02:00
parent 0c14d93bc6
commit 652e9cba3d
3 changed files with 6 additions and 5 deletions

View File

@@ -1 +1,2 @@
Violations of Best Practice/Implementation Hiding/VisibleForTestingAbuse.ql
query: Violations of Best Practice/Implementation Hiding/VisibleForTestingAbuse.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -5,6 +5,6 @@ import packagetwo.Annotated;
public class SourcePackage extends Annotated {
void f() {
AnnotatedClass a = new AnnotatedClass(); // COMPLIANT - same package
String s1 = Annotated.m1; // NON_COMPLIANT
String s1 = Annotated.m1; // $ Alert
}
}

View File

@@ -4,9 +4,9 @@ import packageone.*;
public class Source {
void f() {
int i = Annotated.f(); // NON_COMPLIANT
String s = Annotated.m; // NON_COMPLIANT
AnnotatedClass a = new AnnotatedClass(); // NON_COMPLIANT
int i = Annotated.f(); // $ Alert
String s = Annotated.m; // $ Alert
AnnotatedClass a = new AnnotatedClass(); // $ Alert
String s1 = Annotated.m1; // COMPLIANT - same package
}
}