forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
55 lines (47 loc) · 1.2 KB
/
Test.java
File metadata and controls
55 lines (47 loc) · 1.2 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public class Test {
// OK: may be assigned by init() below
private int foo;
public Test() {
init();
}
private native void init();
public int getFoo() {
return foo;
}
}
class GsonTest {
@com.google.gson.annotations.Expose private String s; // OK
public String getS() { return s; }
}
class JacksonTest {
@com.fasterxml.jackson.annotation.JsonIgnore
private int i; // not OK; field is ignored for Jackson JSON deserialization
public int getI() { return i; }
{
new com.fasterxml.jackson.databind.ObjectMapper().readValue("...", JacksonTest.class);
}
}
class JacksonTest3 {
private int i; // not OK; field is never deserialized
public int getI() { return i; }
}
@com.fasterxml.jackson.annotation.JsonAutoDetect
@com.fasterxml.jackson.annotation.JsonIgnoreProperties
class JacksonTest2 {
private int i; // OK
public int getI() { return i; }
{
new com.fasterxml.jackson.databind.ObjectMapper().readValue("...", JacksonTest2.class);
}
}
class JacksonTest4 {
private int i; // OK
public int getI() { return i; }
{
Class<?> clazz = JacksonTest4.class;
readvalue(clazz);
}
public void readvalue(Class<?> clazz) {
new com.fasterxml.jackson.databind.ObjectMapper().readValue("...", clazz);
}
}