-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathTest.java
More file actions
142 lines (130 loc) · 4.96 KB
/
Test.java
File metadata and controls
142 lines (130 loc) · 4.96 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package generatedtest;
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.Callable;
import org.springframework.cache.Cache;
// Test case generated by GenerateFlowTestCase.ql
public class Test {
public class ValueWrapper extends HashMap<Object,Object> implements Cache.ValueWrapper {
ValueWrapper(Object element) {
super();
this.put(null, element);
}
public Object get() { return this.get(null); }
}
public class DummyCache implements Cache {
DummyCache(Object key, Object value) {
this.put(key, value);
}
public void clear() {}
public void evict(Object key) {}
public boolean evictIfPresent(Object key) { return false; }
public Cache.ValueWrapper get(Object key) { return null; }
public <T> T get(Object key, Callable<T> valueLoader) { return null; }
public <T> T get(Object key, Class<T> type) { return null; }
public String getName() { return null; }
public Object getNativeCache() { return null; }
//public default boolean invalidate() { return false; }
public void put(Object key, Object value) {}
//default Cache.ValueWrapper putIfAbsent(Object key, Object value) { return null; }
}
Object getMapKey(Cache.ValueRetrievalException container) { return container.getKey(); }
Object getMapKey(Cache container) { return ((Map)container.getNativeCache()).keySet().iterator().next(); }
Object getMapValue(Cache container) { return container.get(null, (Class)null); }
Object getMapValue(Cache.ValueWrapper container) { return container.get(); }
Object source() { return null; }
void sink(Object o) { }
public void test() {
{
// "org.springframework.cache;Cache$ValueRetrievalException;false;ValueRetrievalException;;;Argument[0];MapKey of Argument[this];value;manual"
Cache.ValueRetrievalException out = null;
Object in = source();
out = new Cache.ValueRetrievalException(in, null, null);
sink(getMapKey(out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache$ValueRetrievalException;false;getKey;;;MapKey of Argument[this];ReturnValue;value;manual"
Object out = null;
Cache.ValueRetrievalException in = new Cache.ValueRetrievalException(source(), null, null);
out = in.getKey();
sink(out); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache$ValueWrapper;true;get;;;MapValue of Argument[this];ReturnValue;value;manual"
Object out = null;
Cache.ValueWrapper in = new ValueWrapper(source());
out = in.get();
sink(out); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;get;(Object);;MapValue of Argument[this];MapValue of ReturnValue;value;manual"
Cache.ValueWrapper out = null;
Cache in = new DummyCache(null, source());
out = in.get(null);
sink(getMapValue(out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;get;(Object,Callable);;MapValue of Argument[this];ReturnValue;value;manual"
Object out = null;
Cache in = new DummyCache(null, source());
out = in.get(null, (Callable)null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;get;(Object,Class);;MapValue of Argument[this];ReturnValue;value;manual"
Object out = null;
Cache in = new DummyCache(null, source());
out = in.get(null, (Class)null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;getNativeCache;;;MapKey of Argument[this];MapKey of ReturnValue;value;manual"
Object out = null;
Cache in = new DummyCache(source(), null);
out = in.getNativeCache();
sink(getMapKey((Cache)out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;getNativeCache;;;MapValue of Argument[this];MapValue of ReturnValue;value;manual"
Object out = null;
Cache in = new DummyCache(null, source());
out = in.getNativeCache();
sink(getMapValue((Cache)out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;put;;;Argument[0];MapKey of Argument[this];value;manual"
Cache out = null;
Object in = source();
out.put(in, null);
sink(getMapKey(out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;put;;;Argument[1];MapValue of Argument[this];value;manual"
Cache out = null;
Object in = source();
out.put(null, in);
sink(getMapValue(out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;putIfAbsent;;;Argument[0];MapKey of Argument[this];value;manual"
Cache out = null;
Object in = source();
out.putIfAbsent(in, null);
sink(getMapKey(out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;putIfAbsent;;;Argument[1];MapValue of Argument[this];value;manual"
Cache out = null;
Object in = source();
out.putIfAbsent(null, in);
sink(getMapValue(out)); // $ hasValueFlow
}
{
// "org.springframework.cache;Cache;true;putIfAbsent;;;MapValue of Argument[this];MapValue of ReturnValue;value;manual"
Cache.ValueWrapper out = null;
Cache in = new DummyCache(null, source());
out = in.putIfAbsent(null, null);
sink(getMapValue(out)); // $ hasValueFlow
}
}
}