forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF.java
More file actions
34 lines (28 loc) · 778 Bytes
/
F.java
File metadata and controls
34 lines (28 loc) · 778 Bytes
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
public class F {
public void m1(Object obj) {
if (obj == null)
throwMyException();
obj.hashCode(); // OK
}
public void m2(Object obj) {
if (obj == null)
doStuff();
obj.hashCode(); // NPE
}
public void m3(Object obj) {
if (obj == null)
doStuffOrThrow(0);
obj.hashCode(); // NPE
}
public static class MyException extends RuntimeException {
}
public void throwMyException() { // meant to always throw
throw new MyException();
}
public void doStuff() { // meant to be overridden as indicated by UnsupportedOperationException
throw new UnsupportedOperationException();
}
public void doStuffOrThrow(int i) { // meant to be overridden as indicated by unused parameter
throw new MyException();
}
}