Manually improve tests

This commit is contained in:
Owen Mansel-Chan
2021-06-24 16:57:16 +01:00
parent 1bb33bca33
commit 2fd4c9f1b9
2 changed files with 137 additions and 112 deletions

View File

@@ -3,6 +3,8 @@ package generatedtest;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Vector;
import org.apache.commons.collections4.Factory;
import org.apache.commons.collections4.IterableMap;
import org.apache.commons.collections4.IterableSortedMap;
@@ -23,12 +25,35 @@ import org.apache.commons.collections4.map.MultiValueMap;
//Test case generated by GenerateFlowTestCase.ql
public class Test {
Object getMapKey(Object container) { return null; }
Object getMapValue(Object container) { return null; }
Object newWithArrayElement(Object element) { return null; }
Object newWithElement(Object element) { return null; }
Object newWithMapKey(Object element) { return null; }
Object newWithMapValue(Object element) { return null; }
static Object getMapKey(AbstractKeyValue container) { return container.getKey(); }
static Object getMapKeyFromEntry(Map.Entry container) { return container.getKey(); }
static Object getMapKey(AbstractMapEntryDecorator container) { return container.getKey(); }
static Object getMapKey(Map container) { return container.keySet().iterator().next(); }
static Object getMapValue(AbstractKeyValue container) { return container.getValue(); }
static Object getMapValueFromEntry(Map.Entry container) { return container.getValue(); }
static Object getMapValue(AbstractMapEntryDecorator container) { return container.getValue(); }
static Object getMapValue(Map container) { return container.get(null); }
Object[] newWithArrayElement(Object element) { return new Object[] {element}; }
Object newWithElement(Object element) { Vector<String> v = new Vector<String>(); v.add((String)element); return v; }
MyAbstractKeyValue newMAKVWithMapKey(Object element) { return new MyAbstractKeyValue(element,null); }
DefaultKeyValue newDKVWithMapKey(Object element) { return new DefaultKeyValue(element,null); }
MyAbstractMapEntry newMAMEWithMapKey(Object element) { return new MyAbstractMapEntry(element,null); }
MyAbstractMapEntryDecorator newMAMEDWithMapKey(Object element) { return new MyAbstractMapEntryDecorator(newMAMEWithMapKey(element)); }
ResourceBundle newRBWithMapKey(Object element) { return (ResourceBundle)null; }
Map newTreeMapWithMapKey(Object element) { Map m = new TreeMap(); m.put(element,null); return m; }
TiedMapEntry newTMEWithMapKey(Object element) { return new TiedMapEntry(newTreeMapWithMapKey(element),element); }
MyAbstractKeyValue newMAKVWithMapValue(Object element) { return new MyAbstractKeyValue(null,element); }
DefaultKeyValue newDKVWithMapValue(Object element) { return new DefaultKeyValue(null,element); }
MyAbstractMapEntry newMAMEWithMapValue(Object element) { return new MyAbstractMapEntry(null,element); }
MyAbstractMapEntryDecorator newMAMEDWithMapValue(Object element) { return new MyAbstractMapEntryDecorator(newMAMEWithMapValue(element)); }
ResourceBundle newRBWithMapValue(Object element) { return (ResourceBundle)null; }
Map newTreeMapWithMapValue(Object element) { Map m = new TreeMap(); m.put(null,element); return m; }
TiedMapEntry newTMEWithMapValue(Object element) { return new TiedMapEntry(newTreeMapWithMapValue(element),null); }
UnmodifiableMapEntry newUMEWithMapValue(Object element) { return new UnmodifiableMapEntry(null,element); }
Object source() { return null; }
void sink(Object o) { }
@@ -99,21 +124,21 @@ public class Test {
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setKey;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
DefaultKeyValue in = (DefaultKeyValue)newWithMapValue(source());
DefaultKeyValue in = (DefaultKeyValue)newDKVWithMapValue(source());
out = in.setKey(null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setKey;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
MyAbstractKeyValue in = (MyAbstractKeyValue)newWithMapValue(source());
MyAbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapValue(source());
out = in.mySetKey(null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setKey;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
MyAbstractKeyValue in = (MyAbstractKeyValue)newWithMapValue(source());
MyAbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapValue(source());
out = in.mySetKey((Object)null);
sink(out); // $hasValueFlow
}
@@ -148,56 +173,56 @@ public class Test {
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
UnmodifiableMapEntry in = (UnmodifiableMapEntry)newWithMapValue(source());
UnmodifiableMapEntry in = (UnmodifiableMapEntry)newUMEWithMapValue(source());
out = in.setValue(null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
DefaultKeyValue in = (DefaultKeyValue)newWithMapValue(source());
DefaultKeyValue in = (DefaultKeyValue)newDKVWithMapValue(source());
out = in.setValue(null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
AbstractMapEntry in = (MyAbstractMapEntry)newWithMapValue(source());
AbstractMapEntry in = (MyAbstractMapEntry)newMAMEWithMapValue(source());
out = in.setValue(null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
AbstractMapEntry in = (MyAbstractMapEntry)newWithMapValue(source());
AbstractMapEntry in = (MyAbstractMapEntry)newMAMEWithMapValue(source());
out = in.setValue((Object)null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
MyAbstractKeyValue in = (MyAbstractKeyValue)newWithMapValue(source());
MyAbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapValue(source());
out = in.mySetValue(null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;setValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
MyAbstractKeyValue in = (MyAbstractKeyValue)newWithMapValue(source());
MyAbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapValue(source());
out = in.mySetValue((Object)null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;toString;;;MapKey of Argument[-1];ReturnValue;taint"
String out = null;
AbstractKeyValue in = (MyAbstractKeyValue)newWithMapKey(source());
AbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapKey(source());
out = in.toString();
sink(out); // $hasTaintFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractKeyValue;true;toString;;;MapValue of Argument[-1];ReturnValue;taint"
String out = null;
AbstractKeyValue in = (MyAbstractKeyValue)newWithMapValue(source());
AbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapValue(source());
out = in.toString();
sink(out); // $hasTaintFlow
}
@@ -218,70 +243,70 @@ public class Test {
{
// "org.apache.commons.collections4.keyvalue;AbstractMapEntryDecorator;true;AbstractMapEntryDecorator;;;MapKey of Argument[0];MapKey of Argument[-1];value"
AbstractMapEntryDecorator out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapKey(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapKey(source());
out = new MyAbstractMapEntryDecorator(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractMapEntryDecorator;true;AbstractMapEntryDecorator;;;MapValue of Argument[0];MapValue of Argument[-1];value"
AbstractMapEntryDecorator out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapValue(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapValue(source());
out = new MyAbstractMapEntryDecorator(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractMapEntryDecorator;true;getMapEntry;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
Map.Entry<String,String> out = null;
MyAbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newWithMapKey(source());
MyAbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newMAMEDWithMapKey(source());
out = in.myGetMapEntry();
sink(getMapKey(out)); // $hasValueFlow
sink(getMapKeyFromEntry(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractMapEntryDecorator;true;getMapEntry;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
Map.Entry<String,String> out = null;
MyAbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newWithMapValue(source());
MyAbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newMAMEDWithMapValue(source());
out = in.myGetMapEntry();
sink(getMapValue(out)); // $hasValueFlow
sink(getMapValueFromEntry(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractMapEntryDecorator;true;toString;;;MapKey of Argument[-1];ReturnValue;taint"
String out = null;
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newWithMapKey(source());
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newMAMEDWithMapKey(source());
out = in.toString();
sink(out); // $hasTaintFlow
}
{
// "org.apache.commons.collections4.keyvalue;AbstractMapEntryDecorator;true;toString;;;MapValue of Argument[-1];ReturnValue;taint"
String out = null;
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newWithMapValue(source());
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newMAMEDWithMapValue(source());
out = in.toString();
sink(out); // $hasTaintFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultKeyValue;true;DefaultKeyValue;(Entry);;MapKey of Argument[0];MapKey of Argument[-1];value"
DefaultKeyValue out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapKey(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapKey(source());
out = new DefaultKeyValue(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultKeyValue;true;DefaultKeyValue;(Entry);;MapValue of Argument[0];MapValue of Argument[-1];value"
DefaultKeyValue out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapValue(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapValue(source());
out = new DefaultKeyValue(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultKeyValue;true;DefaultKeyValue;(KeyValue);;MapKey of Argument[0];MapKey of Argument[-1];value"
DefaultKeyValue out = null;
KeyValue in = (KeyValue)newWithMapKey(source());
KeyValue in = (KeyValue)newMAKVWithMapKey(source());
out = new DefaultKeyValue(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultKeyValue;true;DefaultKeyValue;(KeyValue);;MapValue of Argument[0];MapValue of Argument[-1];value"
DefaultKeyValue out = null;
KeyValue in = (KeyValue)newWithMapValue(source());
KeyValue in = (KeyValue)newMAKVWithMapValue(source());
out = new DefaultKeyValue(in);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -302,42 +327,42 @@ public class Test {
{
// "org.apache.commons.collections4.keyvalue;DefaultKeyValue;true;toMapEntry;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
Map.Entry<String,String> out = null;
DefaultKeyValue in = (DefaultKeyValue)newWithMapKey(source());
DefaultKeyValue in = (DefaultKeyValue)newDKVWithMapKey(source());
out = in.toMapEntry();
sink(getMapKey(out)); // $hasValueFlow
sink(getMapKeyFromEntry(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultKeyValue;true;toMapEntry;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
Map.Entry<String,String> out = null;
DefaultKeyValue in = (DefaultKeyValue)newWithMapValue(source());
DefaultKeyValue in = (DefaultKeyValue)newDKVWithMapValue(source());
out = in.toMapEntry();
sink(getMapValue(out)); // $hasValueFlow
sink(getMapValueFromEntry(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultMapEntry;true;DefaultMapEntry;(Entry);;MapKey of Argument[0];MapKey of Argument[-1];value"
DefaultMapEntry out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapKey(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapKey(source());
out = new DefaultMapEntry(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultMapEntry;true;DefaultMapEntry;(Entry);;MapValue of Argument[0];MapValue of Argument[-1];value"
DefaultMapEntry out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapValue(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapValue(source());
out = new DefaultMapEntry(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultMapEntry;true;DefaultMapEntry;(KeyValue);;MapKey of Argument[0];MapKey of Argument[-1];value"
DefaultMapEntry out = null;
KeyValue in = (KeyValue)newWithMapKey(source());
KeyValue in = (KeyValue)newMAKVWithMapKey(source());
out = new DefaultMapEntry(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;DefaultMapEntry;true;DefaultMapEntry;(KeyValue);;MapValue of Argument[0];MapValue of Argument[-1];value"
DefaultMapEntry out = null;
KeyValue in = (KeyValue)newWithMapValue(source());
KeyValue in = (KeyValue)newMAKVWithMapValue(source());
out = new DefaultMapEntry(in);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -360,40 +385,40 @@ public class Test {
TiedMapEntry out = null;
Object in = (Object)source();
out = new TiedMapEntry(null, in);
sink(getMapKey(out)); // $hasValueFlow
sink(getMapKeyFromEntry(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;TiedMapEntry;true;TiedMapEntry;;;MapValue of Argument[0];MapValue of Argument[-1];value"
TiedMapEntry out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = new TiedMapEntry(in, null);
sink(getMapValue(out)); // $hasValueFlow
sink(getMapValueFromEntry(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;UnmodifiableMapEntry;true;UnmodifiableMapEntry;(Entry);;MapKey of Argument[0];MapKey of Argument[-1];value"
UnmodifiableMapEntry out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapKey(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapKey(source());
out = new UnmodifiableMapEntry(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;UnmodifiableMapEntry;true;UnmodifiableMapEntry;(Entry);;MapValue of Argument[0];MapValue of Argument[-1];value"
UnmodifiableMapEntry out = null;
Map.Entry<String,String> in = (Map.Entry<String,String>)newWithMapValue(source());
Map.Entry<String,String> in = (Map.Entry<String,String>)newMAKVWithMapValue(source());
out = new UnmodifiableMapEntry(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;UnmodifiableMapEntry;true;UnmodifiableMapEntry;(KeyValue);;MapKey of Argument[0];MapKey of Argument[-1];value"
UnmodifiableMapEntry out = null;
KeyValue in = (KeyValue)newWithMapKey(source());
KeyValue in = (KeyValue)newMAKVWithMapKey(source());
out = new UnmodifiableMapEntry(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4.keyvalue;UnmodifiableMapEntry;true;UnmodifiableMapEntry;(KeyValue);;MapValue of Argument[0];MapValue of Argument[-1];value"
UnmodifiableMapEntry out = null;
KeyValue in = (KeyValue)newWithMapValue(source());
KeyValue in = (KeyValue)newMAKVWithMapValue(source());
out = new UnmodifiableMapEntry(in);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -414,56 +439,56 @@ public class Test {
{
// "org.apache.commons.collections4;KeyValue;true;getKey;;;MapKey of Argument[-1];ReturnValue;value"
Object out = null;
TiedMapEntry in = (TiedMapEntry)newWithMapKey(source());
TiedMapEntry in = (TiedMapEntry)newTMEWithMapKey(source());
out = in.getKey();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getKey;;;MapKey of Argument[-1];ReturnValue;value"
Object out = null;
KeyValue in = (KeyValue)newWithMapKey(source());
KeyValue in = (KeyValue)newMAKVWithMapKey(source());
out = in.getKey();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getKey;;;MapKey of Argument[-1];ReturnValue;value"
Object out = null;
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newWithMapKey(source());
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newMAMEDWithMapKey(source());
out = in.getKey();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getKey;;;MapKey of Argument[-1];ReturnValue;value"
Object out = null;
AbstractKeyValue in = (MyAbstractKeyValue)newWithMapKey(source());
AbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapKey(source());
out = in.getKey();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
TiedMapEntry in = (TiedMapEntry)newWithMapValue(source());
TiedMapEntry in = (TiedMapEntry)newTMEWithMapValue(source());
out = in.getValue();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
KeyValue in = (KeyValue)newWithMapValue(source());
KeyValue in = (KeyValue)newMAKVWithMapValue(source());
out = in.getValue();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newWithMapValue(source());
AbstractMapEntryDecorator in = (MyAbstractMapEntryDecorator)newMAMEDWithMapValue(source());
out = in.getValue();
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;KeyValue;true;getValue;;;MapValue of Argument[-1];ReturnValue;value"
Object out = null;
AbstractKeyValue in = (MyAbstractKeyValue)newWithMapValue(source());
AbstractKeyValue in = (MyAbstractKeyValue)newMAKVWithMapValue(source());
out = in.getValue();
sink(out); // $hasValueFlow
}
@@ -477,28 +502,28 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;fixedSizeMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.fixedSizeMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;fixedSizeMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.fixedSizeMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;fixedSizeSortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.fixedSizeSortedMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;fixedSizeSortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.fixedSizeSortedMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -512,14 +537,14 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;getMap;;;MapValue of Argument[0];ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.getMap(in, null, null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;getMap;;;MapValue of Argument[0];ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.getMap(in, null);
sink(out); // $hasValueFlow
}
@@ -533,14 +558,14 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;getObject;;;MapValue of Argument[0];ReturnValue;value"
Object out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.getObject(in, null, null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;getObject;;;MapValue of Argument[0];ReturnValue;value"
Object out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.getObject(in, null);
sink(out); // $hasValueFlow
}
@@ -554,168 +579,168 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;getString;;;MapValue of Argument[0];ReturnValue;value"
String out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.getString(in, null, null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;getString;;;MapValue of Argument[0];ReturnValue;value"
String out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.getString(in, null);
sink(out); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;invertMap;;;MapKey of Argument[0];MapValue of ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.invertMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;invertMap;;;MapValue of Argument[0];MapKey of ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.invertMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;iterableMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.iterableMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;iterableMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.iterableMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;iterableSortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableSortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.iterableSortedMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;iterableSortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableSortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.iterableSortedMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazyMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.lazyMap(in, (Transformer)null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazyMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.lazyMap(in, (Factory)null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazyMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.lazyMap(in, (Transformer)null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazyMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.lazyMap(in, (Factory)null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazySortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.lazySortedMap(in, (Transformer)null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazySortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.lazySortedMap(in, (Factory)null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazySortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.lazySortedMap(in, (Transformer)null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;lazySortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.lazySortedMap(in, (Factory)null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;multiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
MultiValueMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.multiValueMap(in, (Factory)null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;multiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
MultiValueMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.multiValueMap(in, (Class)null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;multiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
MultiValueMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.multiValueMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;multiValueMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
MultiValueMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.multiValueMap(in, (Factory)null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;multiValueMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
MultiValueMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.multiValueMap(in, (Class)null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;multiValueMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
MultiValueMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.multiValueMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;orderedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
OrderedMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.orderedMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;orderedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
OrderedMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.orderedMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -738,28 +763,28 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;predicatedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.predicatedMap(in, null, null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;predicatedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.predicatedMap(in, null, null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;predicatedSortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.predicatedSortedMap(in, null, null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;predicatedSortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.predicatedSortedMap(in, null, null);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -822,28 +847,28 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;putAll;;;MapKey of ArrayElement of Argument[1];MapKey of Argument[0];value"
Map out = null;
Object[] in = (Object[])newWithArrayElement(newWithMapKey(source()));
Object[] in = (Object[])newWithArrayElement(newMAKVWithMapKey(source()));
MapUtils.putAll(out, in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;putAll;;;MapKey of ArrayElement of Argument[1];MapKey of ReturnValue;value"
Map out = null;
Object[] in = (Object[])newWithArrayElement(newWithMapKey(source()));
Object[] in = (Object[])newWithArrayElement(newMAKVWithMapKey(source()));
out = MapUtils.putAll(null, in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;putAll;;;MapValue of ArrayElement of Argument[1];MapValue of Argument[0];value"
Map out = null;
Object[] in = (Object[])newWithArrayElement(newWithMapValue(source()));
Object[] in = (Object[])newWithArrayElement(newMAKVWithMapValue(source()));
MapUtils.putAll(out, in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;putAll;;;MapValue of ArrayElement of Argument[1];MapValue of ReturnValue;value"
Map out = null;
Object[] in = (Object[])newWithArrayElement(newWithMapValue(source()));
Object[] in = (Object[])newWithArrayElement(newMAKVWithMapValue(source()));
out = MapUtils.putAll(null, in);
sink(getMapValue(out)); // $hasValueFlow
}
@@ -864,98 +889,98 @@ public class Test {
{
// "org.apache.commons.collections4;MapUtils;true;synchronizedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.synchronizedMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;synchronizedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.synchronizedMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;synchronizedSortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.synchronizedSortedMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;synchronizedSortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.synchronizedSortedMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;toMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
Map out = null;
ResourceBundle in = (ResourceBundle)newWithMapKey(source());
ResourceBundle in = (ResourceBundle)newRBWithMapKey(source());
out = MapUtils.toMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;toMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
Map out = null;
ResourceBundle in = (ResourceBundle)newWithMapValue(source());
ResourceBundle in = (ResourceBundle)newRBWithMapValue(source());
out = MapUtils.toMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;transformedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.transformedMap(in, null, null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;transformedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
IterableMap out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.transformedMap(in, null, null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;transformedSortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.transformedSortedMap(in, null, null);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;transformedSortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.transformedSortedMap(in, null, null);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;unmodifiableMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapKey(source());
Map in = (Map)newTreeMapWithMapKey(source());
out = MapUtils.unmodifiableMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;unmodifiableMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
Map out = null;
Map in = (Map)newWithMapValue(source());
Map in = (Map)newTreeMapWithMapValue(source());
out = MapUtils.unmodifiableMap(in);
sink(getMapValue(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;unmodifiableSortedMap;;;MapKey of Argument[0];MapKey of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapKey(source());
SortedMap in = (SortedMap)newTreeMapWithMapKey(source());
out = MapUtils.unmodifiableSortedMap(in);
sink(getMapKey(out)); // $hasValueFlow
}
{
// "org.apache.commons.collections4;MapUtils;true;unmodifiableSortedMap;;;MapValue of Argument[0];MapValue of ReturnValue;value"
SortedMap out = null;
SortedMap in = (SortedMap)newWithMapValue(source());
SortedMap in = (SortedMap)newTreeMapWithMapValue(source());
out = MapUtils.unmodifiableSortedMap(in);
sink(getMapValue(out)); // $hasValueFlow
}

View File

@@ -9,12 +9,8 @@ class SummaryModelTest extends SummaryModelCsv {
row =
[
//"package;type;overrides;name;signature;ext;inputspec;outputspec;kind",
"generatedtest;Test;false;getMapValue;;;MapValue of Argument[0];ReturnValue;value",
"generatedtest;Test;false;getMapKey;;;MapKey of Argument[0];ReturnValue;value",
"generatedtest;Test;false;newWithMapValue;;;Argument[0];MapValue of ReturnValue;value",
"generatedtest;Test;false;newWithElement;;;Argument[0];Element of ReturnValue;value",
"generatedtest;Test;false;newWithArrayElement;;;Argument[0];ArrayElement of ReturnValue;value",
"generatedtest;Test;false;newWithMapKey;;;Argument[0];MapKey of ReturnValue;value"
"generatedtest;Test;false;newRBWithMapValue;;;Argument[0];MapValue of ReturnValue;value",
"generatedtest;Test;false;newRBWithMapKey;;;Argument[0];MapKey of ReturnValue;value"
]
}
}
@@ -29,6 +25,8 @@ class ValueFlowConf extends DataFlow::Configuration {
override predicate isSink(DataFlow::Node n) {
n.asExpr().(Argument).getCall().getCallee().hasName("sink")
}
override int fieldFlowBranchLimit() { result = 1000 }
}
class TaintFlowConf extends TaintTracking::Configuration {
@@ -41,6 +39,8 @@ class TaintFlowConf extends TaintTracking::Configuration {
override predicate isSink(DataFlow::Node n) {
n.asExpr().(Argument).getCall().getCallee().hasName("sink")
}
override int fieldFlowBranchLimit() { result = 1000 }
}
class HasFlowTest extends InlineExpectationsTest {