Skip to content

Commit e3d28fd

Browse files
committed
Add exercises
1 parent 65d8560 commit e3d28fd

57 files changed

Lines changed: 1234 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies:
4+
codeql/java-all:
5+
version: 0.5.0
6+
codeql/regex:
7+
version: 0.0.4
8+
codeql/tutorial:
9+
version: 0.0.1
10+
codeql/typetracking:
11+
version: 0.0.1
12+
codeql/util:
13+
version: 0.0.1
14+
compiled: false

‎exercises-tests/exercise1/Exercise1.actual‎

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| Test.java:9:11:9:17 | new A(...) |
2+
| Test.java:10:11:10:17 | new B(...) |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Exercise1.ql
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class A {}
2+
3+
class B extends A {}
4+
5+
class Test {
6+
public static void main(String[] args) { alloc(); }
7+
8+
public static void alloc() {
9+
A a = new A();
10+
B b = new B();
11+
}
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| Test.java:59:5:59:12 | foo(...) | Test.java:8:8:8:10 | foo |
2+
| Test.java:60:5:60:11 | bar(...) | Test.java:12:8:12:10 | bar |
3+
| Test.java:61:5:61:11 | foo(...) | Test.java:16:8:16:10 | foo |
4+
| Test.java:62:5:62:12 | foo(...) | Test.java:16:8:16:10 | foo |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Exercise10.ql
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
class A {}
2+
3+
class B extends A {}
4+
5+
class C {
6+
public A a;
7+
8+
void foo() {}
9+
}
10+
11+
class D {
12+
void bar() {}
13+
}
14+
15+
class E extends C {
16+
void foo() {}
17+
}
18+
19+
class Test {
20+
public static void main(String[] args) {
21+
alloc();
22+
move();
23+
store();
24+
load();
25+
call();
26+
}
27+
28+
public static void alloc() {
29+
A a = new A();
30+
B b = new B();
31+
}
32+
33+
public static void move() {
34+
A a = new A();
35+
B b = new B();
36+
a = b;
37+
}
38+
39+
public static void store() {
40+
C c = new C();
41+
A a = new A();
42+
c.a = a;
43+
}
44+
45+
public static void load() {
46+
C c = new C();
47+
B b = new B();
48+
c.a = b;
49+
A a;
50+
51+
a = c.a;
52+
}
53+
54+
public static void call() {
55+
C c1 = new C();
56+
D d = new D();
57+
E e = new E();
58+
C c2 = new E();
59+
c1.foo();
60+
d.bar();
61+
e.foo();
62+
c2.foo();
63+
}
64+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
| Test.java:21:19:21:26 | o | Test.java:71:11:71:17 | new B(...) |
2+
| Test.java:21:19:21:26 | o | Test.java:72:11:72:17 | new C(...) |
3+
| Test.java:35:5:35:18 | A a | Test.java:35:11:35:17 | new A(...) |
4+
| Test.java:36:5:36:18 | B b | Test.java:36:11:36:17 | new B(...) |
5+
| Test.java:40:5:40:18 | A a | Test.java:40:11:40:17 | new A(...) |
6+
| Test.java:40:5:40:18 | A a | Test.java:41:11:41:17 | new B(...) |
7+
| Test.java:41:5:41:18 | B b | Test.java:41:11:41:17 | new B(...) |
8+
| Test.java:46:5:46:18 | C c | Test.java:46:11:46:17 | new C(...) |
9+
| Test.java:47:5:47:18 | A a | Test.java:47:11:47:17 | new A(...) |
10+
| Test.java:52:5:52:18 | C c | Test.java:52:11:52:17 | new C(...) |
11+
| Test.java:53:5:53:18 | B b | Test.java:53:11:53:17 | new B(...) |
12+
| Test.java:55:5:55:8 | A a | Test.java:53:11:53:17 | new B(...) |
13+
| Test.java:61:5:61:18 | C c | Test.java:61:11:61:17 | new C(...) |
14+
| Test.java:62:5:62:18 | D d | Test.java:62:11:62:17 | new D(...) |
15+
| Test.java:63:5:63:18 | E e | Test.java:63:11:63:17 | new E(...) |
16+
| Test.java:70:5:70:23 | Object a | Test.java:70:16:70:22 | new A(...) |
17+
| Test.java:71:5:71:18 | B b | Test.java:71:11:71:17 | new B(...) |
18+
| Test.java:72:5:72:18 | C c | Test.java:72:11:72:17 | new C(...) |
19+
| Test.java:73:5:73:18 | F f | Test.java:73:11:73:17 | new F(...) |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Exercise11.ql

0 commit comments

Comments
 (0)