forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSource.java
More file actions
34 lines (28 loc) · 1.01 KB
/
Source.java
File metadata and controls
34 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package packagetwo;
import packageone.*;
public class Source {
void f() {
// Fields
String s = Annotated.m; // $ Alert
String s1 = Annotated.m1; // COMPLIANT - same package
String s2 = Annotated.m2;
// String s3 = Annotated.m3; // Cannot access private field
// Methods
int i = Annotated.f(); // $ Alert
// int i1 = Annotated.fPrivate(); // Cannot access private method
int i2 = Annotated.fPublic();
int i3 = Annotated.fProtected();
// Other class
AnnotatedClass a = new AnnotatedClass(); // $ Alert
// Lambda usage
Runnable lambda = () -> {
String lambdaS = Annotated.m; // $ Alert
String lambdaS1 = Annotated.m1;
String lambdaS2 = Annotated.m2;
int lambdaI = Annotated.f(); // $ Alert
int lambdaI2 = Annotated.fPublic();
int lambdaI3 = Annotated.fProtected();
};
lambda.run();
}
}