Skip to content

Commit 71f6d59

Browse files
committed
Genericise test util functions
1 parent 60126b4 commit 71f6d59

File tree

1 file changed

+8
-8
lines changed
  • java/ql/test/library-tests/frameworks/spring/util

1 file changed

+8
-8
lines changed

java/ql/test/library-tests/frameworks/spring/util/Test.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
// Test case generated by GenerateFlowTestCase.ql
4646
public class Test {
4747

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); }
5353
Object[] newWithArrayElement(Object element) { return new Object[] {element}; }
5454
Properties newPropertiesWithMapKey(Object element) { Properties p = new Properties(); p.put(element, null); return p; }
5555
Properties newPropertiesWithMapValue(Object element) { Properties p = new Properties(); p.put(null, element); return p; }
@@ -192,7 +192,7 @@ public void test() throws Exception {
192192
{
193193
// "org.springframework.util;CollectionUtils;false;arrayToList;;;ArrayElement of Argument[0];Element of ReturnValue;value"
194194
List out = null;
195-
Object in = (Object)newWithArrayElement(source());
195+
Object[] in = newWithArrayElement(source());
196196
out = CollectionUtils.arrayToList(in);
197197
sink(getElement(out)); // $hasValueFlow
198198
}
@@ -248,7 +248,7 @@ public void test() throws Exception {
248248
{
249249
// "org.springframework.util;CollectionUtils;false;mergeArrayIntoCollection;;;ArrayElement of Argument[0];Element of Argument[1];value"
250250
Collection out = null;
251-
Object in = (Object)newWithArrayElement(source());
251+
Object[] in = newWithArrayElement(source());
252252
CollectionUtils.mergeArrayIntoCollection(in, out);
253253
sink(getElement(out)); // $hasValueFlow
254254
}
@@ -721,7 +721,7 @@ public void test() throws Exception {
721721
{
722722
// "org.springframework.util;ObjectUtils;false;toObjectArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value"
723723
Object[] out = null;
724-
Object in = (Object)newWithArrayElement(source());
724+
Object[] in = newWithArrayElement(source());
725725
out = ObjectUtils.toObjectArray(in);
726726
sink(getArrayElement(out)); // $hasValueFlow
727727
}

0 commit comments

Comments
 (0)