mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
java: add ThreadSafe query (P3)
Co-authored-by: Raúl Pardo <raul.pardo@protonmail.com> Co-authored-by: SimonJorgensenMancofi <simon.jorgensen@mancofi.dk> Co-authored-by: Bjørnar Haugstad Jåtten <bjornjaat@hotmail.com>
This commit is contained in:
22
java/ql/test/query-tests/ThreadSafe/examples/Test2.java
Normal file
22
java/ql/test/query-tests/ThreadSafe/examples/Test2.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package examples;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
// Note: Not marked as thread-safe
|
||||
// We inherit from this in Test3Super.java
|
||||
public class Test2 {
|
||||
int x;
|
||||
protected ArrayList<String> lst = new ArrayList<>();
|
||||
|
||||
public Test2() {
|
||||
this.x = 0;
|
||||
}
|
||||
|
||||
public void changeX() {
|
||||
this.x = x + 1;
|
||||
}
|
||||
|
||||
public void changeLst() {
|
||||
lst.add("Hello");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user