Java: Add WithoutElement model for List.clear and add appropriate test.

This commit is contained in:
Michael Nebel
2023-06-23 14:43:29 +02:00
parent 21ec83a197
commit 0604a85bb1
2 changed files with 11 additions and 1 deletions

View File

@@ -302,6 +302,16 @@ public class B {
List out = null;
Collection in = storeElementList(source()); out.addAll(0,in); sink(readElement(out)); // $ hasValueFlow
}
{
// "java.util;List;true;clear;;;Argument[this].WithoutElement;Argument[this];value;manual"
List out = null;
List in = storeElementList(source()); out = in; out.clear(); sink(readElement(out)); // No flow
}
{
// "java.util;List;true;clear;;;Argument[this].WithoutElement;Argument[this];value;manual"
List out = null;
List in = (List)source(); out = in; out.clear(); sink(out); // $ hasValueFlow
}
{
// "java.util;Vector;true;elementAt;(int);;Element of Argument[this];ReturnValue;value;manual",
Object out = null;