-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathA.java
More file actions
56 lines (50 loc) · 990 Bytes
/
A.java
File metadata and controls
56 lines (50 loc) · 990 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
public class A {
void f() {
Object o = new Object();
if (o == null) { } // Useless check
if (o != null) { } // Useless check
try {
new Object();
} catch(Exception e) {
if (e == null) { // Useless check
throw new Error();
}
}
}
void g(Object o) {
if (o instanceof A) {
A a = (A)o;
if (a != null) { // Useless check
throw new Error();
}
}
}
interface I {
A get();
}
I h() {
final A x = this;
return () -> {
if (x != null) { // Useless check
return x;
}
return new A();
};
}
Object f2(Object x) {
if (x == null) {
return this != null ? this : null; // Useless check
}
if (x != null) { // Useless check
return x;
}
return null;
}
private final Object finalObj = new Object();
public void ex12() {
finalObj.hashCode();
if (finalObj != null) { // Useless check
finalObj.hashCode();
}
}
}