|
45 | 45 | // Test case generated by GenerateFlowTestCase.ql |
46 | 46 | public class Test { |
47 | 47 |
|
48 | | - Object getArrayElement(Object[] container) { return container[0]; } |
49 | | - Object getElement(Collection container) { return container.iterator().next(); } |
50 | | - Object getElement(Iterator container) { return container.next(); } |
51 | | - Object getMapKey(Map container) { return container.keySet().iterator().next(); } |
52 | | - Object getMapValue(Map container) { return container.get(null); } |
| 48 | + <E> E getArrayElement(E[] container) { return container[0]; } |
| 49 | + <E> E getElement(Collection<E> container) { return container.iterator().next(); } |
| 50 | + <E> E getElement(Iterator<E> container) { return container.next(); } |
| 51 | + <K, V> K getMapKey(Map<K, V> container) { return container.keySet().iterator().next(); } |
| 52 | + <K, V> V getMapValue(Map<K, V> container) { return container.get(null); } |
53 | 53 | Object[] newWithArrayElement(Object element) { return new Object[] {element}; } |
54 | 54 | Properties newPropertiesWithMapKey(Object element) { Properties p = new Properties(); p.put(element, null); return p; } |
55 | 55 | Properties newPropertiesWithMapValue(Object element) { Properties p = new Properties(); p.put(null, element); return p; } |
@@ -192,7 +192,7 @@ public void test() throws Exception { |
192 | 192 | { |
193 | 193 | // "org.springframework.util;CollectionUtils;false;arrayToList;;;ArrayElement of Argument[0];Element of ReturnValue;value" |
194 | 194 | List out = null; |
195 | | - Object in = (Object)newWithArrayElement(source()); |
| 195 | + Object[] in = newWithArrayElement(source()); |
196 | 196 | out = CollectionUtils.arrayToList(in); |
197 | 197 | sink(getElement(out)); // $hasValueFlow |
198 | 198 | } |
@@ -248,7 +248,7 @@ public void test() throws Exception { |
248 | 248 | { |
249 | 249 | // "org.springframework.util;CollectionUtils;false;mergeArrayIntoCollection;;;ArrayElement of Argument[0];Element of Argument[1];value" |
250 | 250 | Collection out = null; |
251 | | - Object in = (Object)newWithArrayElement(source()); |
| 251 | + Object[] in = newWithArrayElement(source()); |
252 | 252 | CollectionUtils.mergeArrayIntoCollection(in, out); |
253 | 253 | sink(getElement(out)); // $hasValueFlow |
254 | 254 | } |
@@ -721,7 +721,7 @@ public void test() throws Exception { |
721 | 721 | { |
722 | 722 | // "org.springframework.util;ObjectUtils;false;toObjectArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value" |
723 | 723 | Object[] out = null; |
724 | | - Object in = (Object)newWithArrayElement(source()); |
| 724 | + Object[] in = newWithArrayElement(source()); |
725 | 725 | out = ObjectUtils.toObjectArray(in); |
726 | 726 | sink(getArrayElement(out)); // $hasValueFlow |
727 | 727 | } |
|
0 commit comments