Merge pull request #8639 from atorralba/atorralba/spring-beans-improvements

Java: Improve Spring models
This commit is contained in:
Tony Torralba
2022-04-28 11:59:51 +02:00
committed by GitHub
39 changed files with 1029 additions and 1130 deletions

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added data-flow models for the Spring Framework component `spring-beans`.

View File

@@ -22,6 +22,10 @@ private class FlowSummaries extends SummaryModelCsv {
"org.springframework.beans;PropertyValue;false;getValue;;;Argument[-1].MapValue;ReturnValue;value",
"org.springframework.beans;PropertyValues;true;getPropertyValue;;;Argument[-1].Element;ReturnValue;value",
"org.springframework.beans;PropertyValues;true;getPropertyValues;;;Argument[-1].Element;ReturnValue.ArrayElement;value",
"org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(List);;Argument[0].Element;Argument[-1].Element;value",
"org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(Map);;Argument[0].MapKey;Argument[-1].Element.MapKey;value",
"org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(Map);;Argument[0].MapValue;Argument[-1].Element.MapValue;value",
"org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(PropertyValues);;Argument[0].Element;Argument[-1].Element;value",
"org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[0];Argument[-1].Element.MapKey;value",
"org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[-1];ReturnValue;value",
"org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[1];Argument[-1].Element.MapValue;value",

View File

@@ -5,14 +5,14 @@
import java
/** An interface for web requests in the Spring framework. */
class SpringWebRequest extends Class {
class SpringWebRequest extends Interface {
SpringWebRequest() {
this.hasQualifiedName("org.springframework.web.context.request", "WebRequest")
}
}
/** An interface for web requests in the Spring framework. */
class SpringNativeWebRequest extends Class {
class SpringNativeWebRequest extends Interface {
SpringNativeWebRequest() {
this.hasQualifiedName("org.springframework.web.context.request", "NativeWebRequest")
}

View File

@@ -1,299 +1,284 @@
package generatedtest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.PropertyValues;
// Test case generated by GenerateFlowTestCase.ql
public class Test {
Object getMapKey(PropertyValue container) {
return container.getName();
}
Object getMapValue(PropertyValue container) {
return container.getValue();
}
<T> T getArrayElement(T[] array) {
return array[0];
}
PropertyValue getElement(Iterable<PropertyValue> container) {
return container.iterator().next();
}
<T> T getElement(Iterable<T> it) {
return it.iterator().next();
}
PropertyValue getArrayElement(PropertyValue[] container) {
return container[0];
}
PropertyValue getElementDefault(MutablePropertyValues container) {
return container.getPropertyValue("");
}
PropertyValue newWithMapKey(String element) {
return new PropertyValue(element, null);
}
String getMapKeyDefault(PropertyValue container) {
return container.getName();
}
PropertyValue newWithMapValue(String element) {
return new PropertyValue("", element);
}
Object getMapValueDefault(PropertyValue container) {
return container.getValue();
}
MutablePropertyValues newWithElement(PropertyValue element) {
MutablePropertyValues pv = new MutablePropertyValues();
pv.addPropertyValue(element);
return pv;
}
MutablePropertyValues newMutablePropertyValuesWithElement(PropertyValue element) {
return new MutablePropertyValues(List.of(element));
}
String source() {
return null;
}
MutablePropertyValues newMutablePropertyValuesWithMapKey(Object element) {
return new MutablePropertyValues(Map.of(element, null));
}
void sink(Object o) {}
MutablePropertyValues newMutablePropertyValuesWithMapValue(Object element) {
return new MutablePropertyValues(Map.of(null, element));
}
public void test() {
// @formatter:off
// "org.springframework.beans;PropertyValue;false;;(String,Object);;Argument[0];MapKey of Argument[-1];value",
{
PropertyValue v = new PropertyValue((String) source(), null);
sink(getMapKey(v)); // $hasValueFlow
sink(getMapValue(v)); // Safe
}
// "org.springframework.beans;PropertyValue;false;;(String,Object);;Argument[1];MapValue of Argument[-1];value",
{
PropertyValue v = new PropertyValue("", source());
sink(getMapKey(v)); // Safe
sink(getMapValue(v)); // $hasValueFlow
}
// "org.springframework.beans;PropertyValue;false;;(PropertyValue);;Argument[0];Argument[-1];value",
{
PropertyValue v1 = new PropertyValue((String) source(), null);
PropertyValue v2 = new PropertyValue(v1);
sink(getMapKey(v2)); // $hasValueFlow
sink(getMapValue(v2)); // Safe
Object source() {
return null;
}
PropertyValue v3 = new PropertyValue("safe", source());
PropertyValue v4 = new PropertyValue(v3);
sink(getMapKey(v4)); // Safe
sink(getMapValue(v4)); // $hasValueFlow
}
// "org.springframework.beans;PropertyValue;false;;(PropertyValue,Object);;MapKey of Argument[0];MapKey of Argument[-1];value",
{
PropertyValue v1 = new PropertyValue((String) source(), source());
PropertyValue v2 = new PropertyValue(v1, null);
sink(getMapKey(v2)); // $hasValueFlow
sink(getMapValue(v2)); // Safe
}
// "org.springframework.beans;PropertyValue;false;PropertyValue;(PropertyValue,Object);;Argument[1];MapValue of Argument[-1];value",
{
PropertyValue v1 = new PropertyValue("safe", null);
PropertyValue v2 = new PropertyValue(v1, source());
sink(getMapKey(v2)); // Safe
sink(getMapValue(v2)); // $hasValueFlow
}
// "org.springframework.beans;PropertyValue;false;getName;;;MapKey of Argument[-1];ReturnValue;value",
{
PropertyValue v = new PropertyValue((String) source(), null);
sink(v.getName()); // $hasValueFlow
sink(v.getValue()); // Safe
}
// "org.springframework.beans;PropertyValue;false;getValue;;;MapValue of Argument[-1];ReturnValue;value",
{
PropertyValue v = new PropertyValue("safe", source());
sink(v.getName()); // Safe
sink(v.getValue()); // $hasValueFlow
}
// "org.springframework.beans;PropertyValues;true;getPropertyValue;;;Element of Argument[-1];ReturnValue;value",
{
PropertyValues pv = newWithElement(newWithMapValue(source()));
sink(pv.getPropertyValue("safe").getValue()); // $hasValueFlow
}
// "org.springframework.beans;PropertyValues;true;getPropertyValues;;;Element of Argument[-1];ArrayElement of ReturnValue;value",
{
PropertyValues pv = newWithElement(newWithMapValue(source()));
PropertyValue[] vs = pv.getPropertyValues();
sink(getMapKey(getArrayElement(vs))); // Safe
sink(getMapValue(getArrayElement(vs))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[0];MapKey of Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
pv.add((String) source(), null);
sink(getMapKey(getElement(pv))); // $hasValueFlow
sink(getMapValue(getElement(pv))); // Safe
}
// "org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[-1];ReturnValue;value",
{
MutablePropertyValues pv = new MutablePropertyValues();
sink(getMapKey(getElement(pv.add(source(), null)))); // $hasValueFlow
sink(getMapValue(getElement(pv.add(source(), null)))); // Safe
}
{
MutablePropertyValues pv = new MutablePropertyValues();
sink(getMapKey(getElement(pv.add("safe", source())))); // Safe
sink(getMapValue(getElement(pv.add("safe", source())))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[1];MapValue of Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
pv.add("safe", source());
sink(getMapKey(getElement(pv))); // Safe
sink(getMapValue(getElement(pv))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(PropertyValue);;Argument[0];Element of Argument[-1];value",
{
MutablePropertyValues pv1 = new MutablePropertyValues();
PropertyValue v1 = newWithMapKey(source());
pv1.addPropertyValue(v1);
sink(getMapKey(getElement(pv1))); // $hasValueFlow
sink(getMapValue(getElement(pv1))); // Safe
void sink(Object o) {}
MutablePropertyValues pv2 = new MutablePropertyValues();
PropertyValue v2 = newWithMapValue(source());
pv2.addPropertyValue(v2);
sink(getMapKey(getElement(pv2))); // Safe
sink(getMapValue(getElement(pv2))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(PropertyValue);;Argument[-1];ReturnValue;value",
{
MutablePropertyValues pv1 = new MutablePropertyValues();
PropertyValue v1 = newWithMapKey(source());
PropertyValues pv2 = pv1.addPropertyValue(v1);
sink(getMapKey(getElement(pv2))); // $hasValueFlow
sink(getMapValue(getElement(pv2))); // Safe
public void test() throws Exception {
MutablePropertyValues pv3 = new MutablePropertyValues();
PropertyValue v2 = newWithMapValue(source());
PropertyValues pv4 = pv3.addPropertyValue(v2);
sink(getMapKey(getElement(pv4))); // Safe
sink(getMapValue(getElement(pv4))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(String,Object);;Argument[0];MapKey of Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
pv.addPropertyValue((String)source(), null);
sink(getMapKey(getElement(pv))); // $hasValueFlow
sink(getMapValue(getElement(pv))); // Safe
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(String,Object);;Argument[1];MapValue of Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
pv.addPropertyValue("safe", source());
sink(getMapKey(getElement(pv))); // Safe
sink(getMapValue(getElement(pv))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(Map);;MapKey of Argument[0];MapKey of Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
Map<String, Object> values = new HashMap<String, Object>();
values.put(source(), null);
pv.addPropertyValues(values);
sink(getMapKey(getElement(pv))); // $hasValueFlow
sink(getMapValue(getElement(pv))); // Safe
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(Map);;MapValue of Argument[0];MapValue of Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
Map<String, Object> values = new HashMap<String, Object>();
values.put("", source());
pv.addPropertyValues(values);
sink(getMapKey(getElement(pv))); // Safe
sink(getMapValue(getElement(pv))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(Map);;Argument[-1];ReturnValue;value",
{
MutablePropertyValues pv = new MutablePropertyValues();
Map<String, Object> values = new HashMap<String, Object>();
values.put("", source());
PropertyValues pv2 = pv.addPropertyValues(values);
sink(getMapKey(getElement(pv2))); // Safe
sink(getMapValue(getElement(pv2))); // $hasValueFlow
}
{
MutablePropertyValues pv = new MutablePropertyValues();
Map<String, Object> values = new HashMap<String, Object>();
values.put(source(), null);
PropertyValues pv2 = pv.addPropertyValues(values);
sink(getMapKey(getElement(pv2))); // $hasValueFlow
sink(getMapValue(getElement(pv2))); // Safe
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(PropertyValues);;Element of Argument[0];Element of Argument[-1];value",
{
MutablePropertyValues pv = new MutablePropertyValues();
PropertyValues values = newWithElement(newWithMapKey(source()));
pv.addPropertyValues(values);
sink(getMapKey(getElement(pv))); // $hasValueFlow
sink(getMapValue(getElement(pv))); // Safe
}
{
MutablePropertyValues pv = new MutablePropertyValues();
PropertyValues values = newWithElement(newWithMapValue(source()));
pv.addPropertyValues(values);
sink(getMapKey(getElement(pv))); // Safe
sink(getMapValue(getElement(pv))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(PropertyValues);;Argument[-1];ReturnValue;value",
{
MutablePropertyValues pv = new MutablePropertyValues();
PropertyValues values = newWithElement(newWithMapKey(source()));
PropertyValues pv2 = pv.addPropertyValues(values);
sink(getMapKey(getElement(pv2))); // $hasValueFlow
sink(getMapValue(getElement(pv2))); // Safe
}
{
MutablePropertyValues pv = new MutablePropertyValues();
PropertyValues values = newWithElement(newWithMapValue(source()));
PropertyValues pv2 = pv.addPropertyValues(values);
sink(getMapKey(getElement(pv2))); // Safe
sink(getMapValue(getElement(pv2))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;get;;;MapValue of Element of Argument[-1];ReturnValue;value",
{
MutablePropertyValues pv = newWithElement(newWithMapValue(source()));
sink(pv.get("something")); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;getPropertyValue;;;Element of Argument[-1];ReturnValue;value",
{
MutablePropertyValues pv1 = newWithElement(newWithMapKey(source()));
sink(pv1.getPropertyValue("something").getName()); // $hasValueFlow
sink(pv1.getPropertyValue("something").getValue()); // Safe
{
// "org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(List);;Argument[0].Element;Argument[-1].Element;value"
MutablePropertyValues out = null;
List in = List.of(source());
out = new MutablePropertyValues(in);
sink(getElementDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(Map);;Argument[0].MapKey;Argument[-1].Element.MapKey;value"
MutablePropertyValues out = null;
Map in = Map.of(source(), null);
out = new MutablePropertyValues(in);
sink(getMapKeyDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(Map);;Argument[0].MapValue;Argument[-1].Element.MapValue;value"
MutablePropertyValues out = null;
Map in = Map.of(null, source());
out = new MutablePropertyValues(in);
sink(getMapValueDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;MutablePropertyValues;(PropertyValues);;Argument[0].Element;Argument[-1].Element;value"
MutablePropertyValues out = null;
PropertyValues in = newMutablePropertyValuesWithElement((PropertyValue) source());
out = new MutablePropertyValues(in);
sink(getElementDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[-1];ReturnValue;value"
MutablePropertyValues out = null;
MutablePropertyValues in = (MutablePropertyValues) source();
out = in.add(null, null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[0];Argument[-1].Element.MapKey;value"
MutablePropertyValues out = null;
String in = (String) source();
out.add(in, null);
sink(getMapKeyDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;add;(String,Object);;Argument[1];Argument[-1].Element.MapValue;value"
MutablePropertyValues out = null;
Object in = (Object) source();
out.add(null, in);
sink(getMapValueDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(PropertyValue);;Argument[-1];ReturnValue;value"
MutablePropertyValues out = null;
MutablePropertyValues in = (MutablePropertyValues) source();
out = in.addPropertyValue(null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(PropertyValue);;Argument[0];Argument[-1].Element;value"
MutablePropertyValues out = null;
PropertyValue in = (PropertyValue) source();
out.addPropertyValue(in);
sink(getElementDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(String,Object);;Argument[0];Argument[-1].Element.MapKey;value"
MutablePropertyValues out = null;
String in = (String) source();
out.addPropertyValue(in, null);
sink(getMapKeyDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValue;(String,Object);;Argument[1];Argument[-1].Element.MapValue;value"
MutablePropertyValues out = null;
Object in = (Object) source();
out.addPropertyValue(null, in);
sink(getMapValueDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(Map);;Argument[-1];ReturnValue;value"
MutablePropertyValues out = null;
MutablePropertyValues in = (MutablePropertyValues) source();
out = in.addPropertyValues((Map) null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(Map);;Argument[0].MapKey;Argument[-1].Element.MapKey;value"
MutablePropertyValues out = null;
Map in = Map.of(source(), null);
out.addPropertyValues(in);
sink(getMapKeyDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(Map);;Argument[0].MapValue;Argument[-1].Element.MapValue;value"
MutablePropertyValues out = null;
Map in = Map.of(null, source());
out.addPropertyValues(in);
sink(getMapValueDefault(getElementDefault(out))); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(PropertyValues);;Argument[-1];ReturnValue;value"
MutablePropertyValues out = null;
MutablePropertyValues in = (MutablePropertyValues) source();
out = in.addPropertyValues((PropertyValues) null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;addPropertyValues;(PropertyValues);;Argument[0].Element;Argument[-1].Element;value"
MutablePropertyValues out = null;
PropertyValues in = newMutablePropertyValuesWithElement((PropertyValue) source());
out.addPropertyValues(in);
sink(getElementDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;get;;;Argument[-1].Element.MapValue;ReturnValue;value"
Object out = null;
MutablePropertyValues in = newMutablePropertyValuesWithMapValue(source());
out = in.get(null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;getPropertyValue;;;Argument[-1].Element;ReturnValue;value"
PropertyValue out = null;
MutablePropertyValues in =
newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValue(null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;getPropertyValueList;;;Argument[-1].Element;ReturnValue.Element;value"
List out = null;
MutablePropertyValues in =
newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValueList();
sink(getElement(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;getPropertyValues;;;Argument[-1].Element;ReturnValue.ArrayElement;value"
PropertyValue[] out = null;
MutablePropertyValues in =
newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValues();
sink(getArrayElement(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;MutablePropertyValues;true;setPropertyValueAt;;;Argument[0];Argument[-1].Element;value"
MutablePropertyValues out = null;
PropertyValue in = (PropertyValue) source();
out.setPropertyValueAt(in, 0);
sink(getElementDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;PropertyValue;(PropertyValue);;Argument[0];Argument[-1];value"
PropertyValue out = null;
PropertyValue in = (PropertyValue) source();
out = new PropertyValue(in);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;PropertyValue;(PropertyValue,Object);;Argument[0].MapKey;Argument[-1].MapKey;value"
PropertyValue out = null;
PropertyValue in = new PropertyValue(new PropertyValue((String) source(), null), null);
out = new PropertyValue(in, (Object) null);
sink(getMapKeyDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;PropertyValue;(PropertyValue,Object);;Argument[1];Argument[-1].MapValue;value"
PropertyValue out = null;
Object in = (Object) source();
out = new PropertyValue((PropertyValue) null, in);
sink(getMapValueDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;PropertyValue;(String,Object);;Argument[0];Argument[-1].MapKey;value"
PropertyValue out = null;
String in = (String) source();
out = new PropertyValue(in, (Object) null);
sink(getMapKeyDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;PropertyValue;(String,Object);;Argument[1];Argument[-1].MapValue;value"
PropertyValue out = null;
Object in = (Object) source();
out = new PropertyValue((String) null, in);
sink(getMapValueDefault(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;getName;;;Argument[-1].MapKey;ReturnValue;value"
String out = null;
PropertyValue in = new PropertyValue((String) source(), null);
out = in.getName();
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValue;false;getValue;;;Argument[-1].MapValue;ReturnValue;value"
Object out = null;
PropertyValue in = new PropertyValue("", source());
out = in.getValue();
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValues;true;getPropertyValue;;;Argument[-1].Element;ReturnValue;value"
PropertyValue out = null;
MutablePropertyValues in =
newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValue(null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValues;true;getPropertyValue;;;Argument[-1].Element;ReturnValue;value"
PropertyValue out = null;
PropertyValues in = newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValue(null);
sink(out); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValues;true;getPropertyValues;;;Argument[-1].Element;ReturnValue.ArrayElement;value"
PropertyValue[] out = null;
MutablePropertyValues in =
newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValues();
sink(getArrayElement(out)); // $ hasValueFlow
}
{
// "org.springframework.beans;PropertyValues;true;getPropertyValues;;;Argument[-1].Element;ReturnValue.ArrayElement;value"
PropertyValue[] out = null;
PropertyValues in = newMutablePropertyValuesWithElement((PropertyValue) source());
out = in.getPropertyValues();
sink(getArrayElement(out)); // $ hasValueFlow
}
MutablePropertyValues pv2 = newWithElement(newWithMapValue(source()));
sink(pv2.getPropertyValue("something").getName()); // Safe
sink(pv2.getPropertyValue("something").getValue()); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;getPropertyValueList;;;Element of Argument[-1];Element of ReturnValue;value",
{
MutablePropertyValues pv1 = newWithElement(newWithMapKey(source()));
List<PropertyValue> pvl1 = pv1.getPropertyValueList();
sink(getMapKey(getElement(pvl1))); // $hasValueFlow
sink(getMapValue(getElement(pvl1))); // Safe
}
MutablePropertyValues pv2 = newWithElement(newWithMapValue(source()));
List<PropertyValue> pvl2 = pv2.getPropertyValueList();
sink(getMapKey(getElement(pvl2))); // Safe
sink(getMapValue(getElement(pvl2))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;getPropertyValues;;;Element of Argument[-1];ArrayElement of ReturnValue;value",
{
MutablePropertyValues pv1 = newWithElement(newWithMapKey(source()));
PropertyValue[] pvl1 = pv1.getPropertyValues();
sink(getMapKey(getArrayElement(pvl1))); // $hasValueFlow
sink(getMapValue(getArrayElement(pvl1))); // Safe
MutablePropertyValues pv2 = newWithElement(newWithMapValue(source()));
PropertyValue[] pvl2 = pv2.getPropertyValues();
sink(getMapKey(getArrayElement(pvl2))); // Safe
sink(getMapValue(getArrayElement(pvl2))); // $hasValueFlow
}
// "org.springframework.beans;MutablePropertyValues;true;setPropertyValueAt;;;Argument[0];Element of Argument[-1];value"
{
MutablePropertyValues pv1 = new MutablePropertyValues();
PropertyValue v1 = newWithMapKey(source());
pv1.setPropertyValueAt(v1, 0);
sink(getMapKey(getElement(pv1))); // $hasValueFlow
sink(getMapValue(getElement(pv1))); // Safe
MutablePropertyValues pv2 = new MutablePropertyValues();
PropertyValue v2 = newWithMapValue(source());
pv2.setPropertyValueAt(v2, 0);
sink(getMapKey(getElement(pv2))); // Safe
sink(getMapValue(getElement(pv2))); // $hasValueFlow
}
// @formatter:on
}
}

View File

@@ -0,0 +1,203 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.security.Principal;
import java.time.ZoneId;
import java.util.Locale;
import java.util.TimeZone;
import javax.servlet.http.HttpSession;
import javax.servlet.http.PushBuilder;
import javax.servlet.ServletRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Controller;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.bind.annotation.MatrixVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.SessionAttribute;
public class Test {
static void sink(Object o) {}
@Controller
static class NotTaintedTest {
@RequestMapping("/")
public void get(WebRequest src) {
sink(src);
}
@RequestMapping("/")
public void get(NativeWebRequest src) {
sink(src);
}
@RequestMapping("/")
public void get(ServletRequest src) {
sink(src);
}
@RequestMapping("/")
public void get(HttpSession src) {
sink(src);
}
@RequestMapping("/")
public void get(PushBuilder src) {
sink(src);
}
@RequestMapping("/")
public void get(Principal src) {
sink(src);
}
@RequestMapping("/")
public void get(HttpMethod src) {
sink(src);
}
@RequestMapping("/")
public void get(Locale src) {
sink(src);
}
@RequestMapping("/")
public void get(TimeZone src) {
sink(src);
}
@RequestMapping("/")
public void get(ZoneId src) {
sink(src);
}
@RequestMapping("/")
public void get(OutputStream src) {
sink(src);
}
@RequestMapping("/")
public void get(Writer src) {
sink(src);
}
@RequestMapping("/")
public void get(RedirectAttributes src) {
sink(src);
}
@RequestMapping("/")
public void get(Errors src) {
sink(src);
}
@RequestMapping("/")
public void get(SessionStatus src) {
sink(src);
}
@RequestMapping("/")
public void get(UriComponentsBuilder src) {
sink(src);
}
@RequestMapping("/")
public void get(Pageable src) {
sink(src);
}
}
@Controller
static class ExplicitlyTaintedTest {
@RequestMapping("/")
public void get(InputStream src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void get(Reader src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void matrixVariable(@MatrixVariable Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void requestParam(@RequestParam Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void requestHeader(@RequestHeader Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void cookieValue(@CookieValue Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void requestPart(@RequestPart Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void pathVariable(@PathVariable Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void requestBody(@RequestBody Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void get(HttpEntity src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void requestAttribute(@RequestAttribute Object src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void sessionAttribute(@SessionAttribute Object src) {
sink(src); // $hasValueFlow
}
}
@Controller
static class ImplicitlyTaintedTest {
static class Pojo {
}
@RequestMapping("/")
public void get(String src) {
sink(src); // $hasValueFlow
}
@RequestMapping("/")
public void get1(Pojo src) {
sink(src); // $hasValueFlow
}
}
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8:${testdir}/../../../../stubs/javax-servlet-2.5

View File

@@ -0,0 +1,17 @@
import java
import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest
class ValueFlowConf extends DataFlow::Configuration {
ValueFlowConf() { this = "ValueFlowConf" }
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
override predicate isSink(DataFlow::Node sink) {
sink.asExpr().(Argument).getCall().getCallee().hasName("sink")
}
}
class Test extends InlineFlowTest {
override DataFlow::Configuration getValueFlowConfig() { result = any(ValueFlowConf config) }
}

View File

@@ -1,78 +1,26 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated automatically from org.springframework.context.support.DefaultMessageSourceResolvable for testing purposes
package org.springframework.context.support;
import java.io.Serializable;
import org.springframework.context.MessageSourceResolvable;
import org.springframework.lang.Nullable;
public class DefaultMessageSourceResolvable implements MessageSourceResolvable, Serializable {
public DefaultMessageSourceResolvable(String code) {}
public DefaultMessageSourceResolvable(String[] codes) {}
public DefaultMessageSourceResolvable(String[] codes, String defaultMessage) {}
public DefaultMessageSourceResolvable(String[] codes, Object[] arguments) {}
public DefaultMessageSourceResolvable(
@Nullable String[] codes, @Nullable Object[] arguments, @Nullable String defaultMessage) {}
public DefaultMessageSourceResolvable(MessageSourceResolvable resolvable) {}
public String getCode() {
return null;
}
@Override
public String[] getCodes() {
return null;
}
@Override
public Object[] getArguments() {
return null;
}
@Override
public String getDefaultMessage() {
return null;
}
public boolean shouldRenderDefaultMessage() {
return false;
}
@Override
public String toString() {
return null;
}
@Override
public boolean equals(@Nullable Object other) {
return false;
}
@Override
public int hashCode() {
return 0;
}
protected final String resolvableToString() {
return null;
}
public class DefaultMessageSourceResolvable implements MessageSourceResolvable, Serializable
{
protected DefaultMessageSourceResolvable() {}
protected final String resolvableToString(){ return null; }
public DefaultMessageSourceResolvable(MessageSourceResolvable p0){}
public DefaultMessageSourceResolvable(String p0){}
public DefaultMessageSourceResolvable(String[] p0){}
public DefaultMessageSourceResolvable(String[] p0, Object[] p1){}
public DefaultMessageSourceResolvable(String[] p0, Object[] p1, String p2){}
public DefaultMessageSourceResolvable(String[] p0, String p1){}
public Object[] getArguments(){ return null; }
public String getCode(){ return null; }
public String getDefaultMessage(){ return null; }
public String toString(){ return null; }
public String[] getCodes(){ return null; }
public boolean equals(Object p0){ return false; }
public boolean shouldRenderDefaultMessage(){ return false; }
public int hashCode(){ return 0; }
}

View File

@@ -0,0 +1,25 @@
// Generated automatically from org.springframework.data.domain.Pageable for testing purposes
package org.springframework.data.domain;
import java.util.Optional;
import org.springframework.data.domain.Sort;
public interface Pageable
{
Pageable first();
Pageable next();
Pageable previousOrFirst();
Pageable withPage(int p0);
Sort getSort();
boolean hasPrevious();
default Optional<Pageable> toOptional(){ return null; }
default Sort getSortOr(Sort p0){ return null; }
default boolean isPaged(){ return false; }
default boolean isUnpaged(){ return false; }
int getPageNumber();
int getPageSize();
long getOffset();
static Pageable ofSize(int p0){ return null; }
static Pageable unpaged(){ return null; }
}

View File

@@ -0,0 +1,87 @@
// Generated automatically from org.springframework.data.domain.Sort for testing purposes
package org.springframework.data.domain;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import org.springframework.data.util.MethodInvocationRecorder;
import org.springframework.data.util.Streamable;
public class Sort implements Serializable, Streamable<Sort.Order>
{
protected Sort() {}
protected Sort(List<Sort.Order> p0){}
public Iterator<Sort.Order> iterator(){ return null; }
public Sort and(Sort p0){ return null; }
public Sort ascending(){ return null; }
public Sort descending(){ return null; }
public Sort.Order getOrderFor(String p0){ return null; }
public String toString(){ return null; }
public boolean equals(Object p0){ return false; }
public boolean isEmpty(){ return false; }
public boolean isSorted(){ return false; }
public boolean isUnsorted(){ return false; }
public int hashCode(){ return 0; }
public static <T> Sort.TypedSort<T> sort(Class<T> p0){ return null; }
public static Sort by(List<Sort.Order> p0){ return null; }
public static Sort by(Sort.Direction p0, String... p1){ return null; }
public static Sort by(Sort.Order... p0){ return null; }
public static Sort by(String... p0){ return null; }
public static Sort unsorted(){ return null; }
public static Sort.Direction DEFAULT_DIRECTION = null;
static public class Order implements Serializable
{
protected Order() {}
public Order(Sort.Direction p0, String p1){}
public Order(Sort.Direction p0, String p1, Sort.NullHandling p2){}
public Sort withProperties(String... p0){ return null; }
public Sort.Direction getDirection(){ return null; }
public Sort.NullHandling getNullHandling(){ return null; }
public Sort.Order ignoreCase(){ return null; }
public Sort.Order nullsFirst(){ return null; }
public Sort.Order nullsLast(){ return null; }
public Sort.Order nullsNative(){ return null; }
public Sort.Order with(Sort.Direction p0){ return null; }
public Sort.Order with(Sort.NullHandling p0){ return null; }
public Sort.Order withProperty(String p0){ return null; }
public String getProperty(){ return null; }
public String toString(){ return null; }
public boolean equals(Object p0){ return false; }
public boolean isAscending(){ return false; }
public boolean isDescending(){ return false; }
public boolean isIgnoreCase(){ return false; }
public int hashCode(){ return 0; }
public static Sort.Order asc(String p0){ return null; }
public static Sort.Order by(String p0){ return null; }
public static Sort.Order desc(String p0){ return null; }
}
static public class TypedSort<T> extends Sort
{
protected TypedSort() {}
public <S> Sort.TypedSort<S> by(Function<T, S> p0){ return null; }
public <S> Sort.TypedSort<S> by(MethodInvocationRecorder.Recorded.ToCollectionConverter<T, S> p0){ return null; }
public <S> Sort.TypedSort<S> by(MethodInvocationRecorder.Recorded.ToMapConverter<T, S> p0){ return null; }
public Iterator<Sort.Order> iterator(){ return null; }
public Sort ascending(){ return null; }
public Sort descending(){ return null; }
public String toString(){ return null; }
public boolean isEmpty(){ return false; }
}
static public enum Direction
{
ASC, DESC;
private Direction() {}
public boolean isAscending(){ return false; }
public boolean isDescending(){ return false; }
public static Optional<Sort.Direction> fromOptionalString(String p0){ return null; }
public static Sort.Direction fromString(String p0){ return null; }
}
static public enum NullHandling
{
NATIVE, NULLS_FIRST, NULLS_LAST;
private NullHandling() {}
}
}

View File

@@ -0,0 +1,38 @@
// Generated automatically from org.springframework.data.util.MethodInvocationRecorder for testing purposes
package org.springframework.data.util;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
public class MethodInvocationRecorder
{
protected MethodInvocationRecorder() {}
public static <T> MethodInvocationRecorder.Recorded<T> forProxyOf(Class<T> p0){ return null; }
public static MethodInvocationRecorder.PropertyNameDetectionStrategy DEFAULT = null;
static public class Recorded<T>
{
protected Recorded() {}
public <S> MethodInvocationRecorder.Recorded<S> record(Function<? super T, S> p0){ return null; }
public <S> MethodInvocationRecorder.Recorded<S> record(MethodInvocationRecorder.Recorded.ToCollectionConverter<T, S> p0){ return null; }
public <S> MethodInvocationRecorder.Recorded<S> record(MethodInvocationRecorder.Recorded.ToMapConverter<T, S> p0){ return null; }
public Optional<String> getPropertyPath(){ return null; }
public Optional<String> getPropertyPath(List<MethodInvocationRecorder.PropertyNameDetectionStrategy> p0){ return null; }
public Optional<String> getPropertyPath(MethodInvocationRecorder.PropertyNameDetectionStrategy p0){ return null; }
public String toString(){ return null; }
static public interface ToCollectionConverter<T, S> extends Function<T, Collection<S>>
{
}
static public interface ToMapConverter<T, S> extends Function<T, Map<? extends Object, S>>
{
}
}
static public interface PropertyNameDetectionStrategy
{
String getPropertyName(Method p0);
}
}

View File

@@ -0,0 +1,33 @@
// Generated automatically from org.springframework.data.util.Streamable for testing purposes
package org.springframework.data.util;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Stream;
public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>>
{
default <R> Streamable<R> flatMap(Function<? super T, ? extends Stream<? extends R>> p0){ return null; }
default <R> Streamable<R> map(Function<? super T, ? extends R> p0){ return null; }
default List<T> toList(){ return null; }
default Set<T> toSet(){ return null; }
default Stream<T> get(){ return null; }
default Stream<T> stream(){ return null; }
default Streamable<T> and(Iterable<? extends T> p0){ return null; }
default Streamable<T> and(Streamable<? extends T> p0){ return null; }
default Streamable<T> and(Supplier<? extends Stream<? extends T>> p0){ return null; }
default Streamable<T> and(T... p0){ return null; }
default Streamable<T> filter(Predicate<? super T> p0){ return null; }
default boolean isEmpty(){ return false; }
static <S, T extends Iterable<S>> Collector<S, ? extends Object, Streamable<S>> toStreamable(Collector<S, ? extends Object, T> p0){ return null; }
static <S> Collector<S, ? extends Object, Streamable<S>> toStreamable(){ return null; }
static <T> Streamable<T> empty(){ return null; }
static <T> Streamable<T> of(Iterable<T> p0){ return null; }
static <T> Streamable<T> of(Supplier<? extends Stream<T>> p0){ return null; }
static <T> Streamable<T> of(T... p0){ return null; }
}

View File

@@ -23,7 +23,6 @@ import org.springframework.util.MultiValueMap;
public class HttpHeaders implements MultiValueMap<String, String>, Serializable
{
final MultiValueMap<String, String> headers = null;
protected List<String> getETagValuesAsList(String p0){ return null; }
protected String getFieldValues(String p0){ return null; }
protected String toCommaDelimitedString(List<String> p0){ return null; }
@@ -216,5 +215,4 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
public void setUpgrade(String p0){}
public void setVary(List<String> p0){}
public void setZonedDateTime(String p0, ZonedDateTime p1){}
static String formatDate(long p0){ return null; }
}

View File

@@ -1,41 +1,18 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated automatically from org.springframework.ui.Model for testing purposes
package org.springframework.ui;
import java.util.Collection;
import java.util.Map;
import org.springframework.lang.Nullable;
public interface Model {
Model addAttribute(String attributeName, @Nullable Object attributeValue);
Model addAttribute(Object attributeValue);
Model addAllAttributes(Collection<?> attributeValues);
Model addAllAttributes(Map<String, ?> attributes);
Model mergeAttributes(Map<String, ?> attributes);
boolean containsAttribute(String attributeName);
Object getAttribute(String attributeName);
Map<String, Object> asMap();
public interface Model
{
Map<String, Object> asMap();
Model addAllAttributes(Collection<? extends Object> p0);
Model addAllAttributes(Map<String, ? extends Object> p0);
Model addAttribute(Object p0);
Model addAttribute(String p0, Object p1);
Model mergeAttributes(Map<String, ? extends Object> p0);
Object getAttribute(String p0);
boolean containsAttribute(String p0);
}

View File

@@ -7,7 +7,7 @@ import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Map;
public class MimeType implements Comparable<MimeType>, Serializable
public class MimeType
{
protected MimeType() {}
protected MimeType(MimeType p0){}

View File

@@ -1,84 +1,41 @@
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated automatically from org.springframework.validation.Errors for testing purposes
package org.springframework.validation;
import java.util.List;
import org.springframework.lang.Nullable;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
public interface Errors {
String getObjectName();
void setNestedPath(String nestedPath);
String getNestedPath();
void pushNestedPath(String subPath);
void popNestedPath() throws IllegalStateException;
void reject(String errorCode);
void reject(String errorCode, String defaultMessage);
void reject(String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage);
void rejectValue(@Nullable String field, String errorCode);
void rejectValue(@Nullable String field, String errorCode, String defaultMessage);
void rejectValue(
@Nullable String field,
String errorCode,
@Nullable Object[] errorArgs,
@Nullable String defaultMessage);
void addAllErrors(Errors errors);
boolean hasErrors();
int getErrorCount();
List<ObjectError> getAllErrors();
boolean hasGlobalErrors();
int getGlobalErrorCount();
List<ObjectError> getGlobalErrors();
ObjectError getGlobalError();
boolean hasFieldErrors();
int getFieldErrorCount();
List<FieldError> getFieldErrors();
FieldError getFieldError();
boolean hasFieldErrors(String field);
int getFieldErrorCount(String field);
List<FieldError> getFieldErrors(String field);
FieldError getFieldError(String field);
Object getFieldValue(String field);
Class<?> getFieldType(String field);
public interface Errors
{
Class<? extends Object> getFieldType(String p0);
FieldError getFieldError();
FieldError getFieldError(String p0);
List<FieldError> getFieldErrors();
List<FieldError> getFieldErrors(String p0);
List<ObjectError> getAllErrors();
List<ObjectError> getGlobalErrors();
Object getFieldValue(String p0);
ObjectError getGlobalError();
String getNestedPath();
String getObjectName();
boolean hasErrors();
boolean hasFieldErrors();
boolean hasFieldErrors(String p0);
boolean hasGlobalErrors();
int getErrorCount();
int getFieldErrorCount();
int getFieldErrorCount(String p0);
int getGlobalErrorCount();
static String NESTED_PATH_SEPARATOR = null;
void addAllErrors(Errors p0);
void popNestedPath();
void pushNestedPath(String p0);
void reject(String p0);
void reject(String p0, Object[] p1, String p2);
void reject(String p0, String p1);
void rejectValue(String p0, String p1);
void rejectValue(String p0, String p1, Object[] p2, String p3);
void rejectValue(String p0, String p1, String p2);
void setNestedPath(String p0);
}

View File

@@ -1,60 +1,18 @@
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated automatically from org.springframework.validation.FieldError for testing purposes
package org.springframework.validation;
import org.springframework.lang.Nullable;
import org.springframework.validation.ObjectError;
public class FieldError extends ObjectError {
public FieldError(String objectName, String field, String defaultMessage) { super("", ""); }
public FieldError(
String objectName,
String field,
@Nullable Object rejectedValue,
boolean bindingFailure,
@Nullable String[] codes,
@Nullable Object[] arguments,
@Nullable String defaultMessage) { super("", ""); }
public String getField() {
return null;
}
@Nullable
public Object getRejectedValue() {
return null;
}
public boolean isBindingFailure() {
return false;
}
@Override
public boolean equals(@Nullable Object other) {
return false;
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return null;
}
public class FieldError extends ObjectError
{
protected FieldError() {}
public FieldError(String p0, String p1, Object p2, boolean p3, String[] p4, Object[] p5, String p6){}
public FieldError(String p0, String p1, String p2){}
public Object getRejectedValue(){ return null; }
public String getField(){ return null; }
public String toString(){ return null; }
public boolean equals(Object p0){ return false; }
public boolean isBindingFailure(){ return false; }
public int hashCode(){ return 0; }
}

View File

@@ -1,60 +1,19 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated automatically from org.springframework.validation.ObjectError for testing purposes
package org.springframework.validation;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.lang.Nullable;
public class ObjectError extends DefaultMessageSourceResolvable {
public ObjectError(String objectName, String defaultMessage) { super(""); }
public ObjectError(
String objectName,
@Nullable String[] codes,
@Nullable Object[] arguments,
@Nullable String defaultMessage) { super(""); }
public String getObjectName() {
return null;
}
public void wrap(Object source) {}
public <T> T unwrap(Class<T> sourceType) {
return null;
}
public boolean contains(Class<?> sourceType) {
return false;
}
@Override
public boolean equals(@Nullable Object other) {
return false;
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return "";
}
public class ObjectError extends DefaultMessageSourceResolvable
{
protected ObjectError() {}
public <T> T unwrap(Class<T> p0){ return null; }
public ObjectError(String p0, String p1){}
public ObjectError(String p0, String[] p1, Object[] p2, String p3){}
public String getObjectName(){ return null; }
public String toString(){ return null; }
public boolean contains(Class<? extends Object> p0){ return false; }
public boolean equals(Object p0){ return false; }
public int hashCode(){ return 0; }
public void wrap(Object p0){}
}

View File

@@ -0,0 +1,21 @@
// Generated automatically from org.springframework.web.bind.annotation.CookieValue for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface CookieValue
{
String defaultValue() default "";
String name() default "";
String value() default "";
boolean required() default false;
}

View File

@@ -1,3 +1,5 @@
// Generated automatically from org.springframework.web.bind.annotation.Mapping for testing purposes
package org.springframework.web.bind.annotation;
public @interface Mapping {

View File

@@ -0,0 +1,22 @@
// Generated automatically from org.springframework.web.bind.annotation.MatrixVariable for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface MatrixVariable
{
String defaultValue() default "";
String name() default "";
String pathVar() default "";
String value() default "";
boolean required() default false;
}

View File

@@ -1,3 +1,5 @@
// Generated automatically from org.springframework.web.bind.annotation.PathVariable for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Documented;
@@ -6,10 +8,12 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PathVariable {
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface PathVariable
{
String name() default "";
String value() default "";
}
boolean required() default false;
}

View File

@@ -0,0 +1,20 @@
// Generated automatically from org.springframework.web.bind.annotation.RequestAttribute for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface RequestAttribute
{
String name() default "";
String value() default "";
boolean required() default false;
}

View File

@@ -1,3 +1,5 @@
// Generated automatically from org.springframework.web.bind.annotation.RequestBody for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Documented;
@@ -6,10 +8,10 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RequestBody {
boolean required() default true;
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface RequestBody
{
boolean required() default false;
}

View File

@@ -0,0 +1,21 @@
// Generated automatically from org.springframework.web.bind.annotation.RequestHeader for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface RequestHeader
{
String defaultValue() default "";
String name() default "";
String value() default "";
boolean required() default false;
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated automatically from org.springframework.web.bind.annotation.RequestMapping for testing purposes
package org.springframework.web.bind.annotation;
@@ -22,188 +8,18 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Annotation for mapping web requests onto methods in request-handling classes
* with flexible method signatures.
*
* <p>Both Spring MVC and Spring WebFlux support this annotation through a
* {@code RequestMappingHandlerMapping} and {@code RequestMappingHandlerAdapter}
* in their respective modules and package structure. For the exact list of
* supported handler method arguments and return types in each, please use the
* reference documentation links below:
* <ul>
* <li>Spring MVC
* <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#mvc-ann-arguments">Method Arguments</a>
* and
* <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#mvc-ann-return-types">Return Values</a>
* </li>
* <li>Spring WebFlux
* <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html#webflux-ann-arguments">Method Arguments</a>
* and
* <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html#webflux-ann-return-types">Return Values</a>
* </li>
* </ul>
*
* <p><strong>Note:</strong> This annotation can be used both at the class and
* at the method level. In most cases, at the method level applications will
* prefer to use one of the HTTP method specific variants
* {@link GetMapping @GetMapping}, {@link PostMapping @PostMapping},
* {@link PutMapping @PutMapping}, {@link DeleteMapping @DeleteMapping}, or
* {@link PatchMapping @PatchMapping}.</p>
*
* <p><b>NOTE:</b> When using controller interfaces (e.g. for AOP proxying),
* make sure to consistently put <i>all</i> your mapping annotations - such as
* {@code @RequestMapping} and {@code @SessionAttributes} - on
* the controller <i>interface</i> rather than on the implementation class.
*
* @author Juergen Hoeller
* @author Arjen Poutsma
* @author Sam Brannen
* @since 2.5
* @see GetMapping
* @see PostMapping
* @see PutMapping
* @see DeleteMapping
* @see PatchMapping
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Mapping
public @interface RequestMapping {
/**
* Assign a name to this mapping.
* <p><b>Supported at the type level as well as at the method level!</b>
* When used on both levels, a combined name is derived by concatenation
* with "#" as separator.
* @see org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder
* @see org.springframework.web.servlet.handler.HandlerMethodMappingNamingStrategy
*/
String name() default "";
/**
* The primary mapping expressed by this annotation.
* <p>This is an alias for {@link #path}. For example,
* {@code @RequestMapping("/foo")} is equivalent to
* {@code @RequestMapping(path="/foo")}.
* <p><b>Supported at the type level as well as at the method level!</b>
* When used at the type level, all method-level mappings inherit
* this primary mapping, narrowing it for a specific handler method.
* <p><strong>NOTE</strong>: A handler method that is not mapped to any path
* explicitly is effectively mapped to an empty path.
*/
@AliasFor("path")
String[] value() default {};
/**
* The path mapping URIs (e.g. {@code "/profile"}).
* <p>Ant-style path patterns are also supported (e.g. {@code "/profile/**"}).
* At the method level, relative paths (e.g. {@code "edit"}) are supported
* within the primary mapping expressed at the type level.
* Path mapping URIs may contain placeholders (e.g. <code>"/${profile_path}"</code>).
* <p><b>Supported at the type level as well as at the method level!</b>
* When used at the type level, all method-level mappings inherit
* this primary mapping, narrowing it for a specific handler method.
* <p><strong>NOTE</strong>: A handler method that is not mapped to any path
* explicitly is effectively mapped to an empty path.
* @since 4.2
*/
@AliasFor("value")
String[] path() default {};
/**
* The HTTP request methods to map to, narrowing the primary mapping:
* GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE, TRACE.
* <p><b>Supported at the type level as well as at the method level!</b>
* When used at the type level, all method-level mappings inherit this
* HTTP method restriction.
*/
RequestMethod[] method() default {};
/**
* The parameters of the mapped request, narrowing the primary mapping.
* <p>Same format for any environment: a sequence of "myParam=myValue" style
* expressions, with a request only mapped if each such parameter is found
* to have the given value. Expressions can be negated by using the "!=" operator,
* as in "myParam!=myValue". "myParam" style expressions are also supported,
* with such parameters having to be present in the request (allowed to have
* any value). Finally, "!myParam" style expressions indicate that the
* specified parameter is <i>not</i> supposed to be present in the request.
* <p><b>Supported at the type level as well as at the method level!</b>
* When used at the type level, all method-level mappings inherit this
* parameter restriction.
*/
String[] params() default {};
/**
* The headers of the mapped request, narrowing the primary mapping.
* <p>Same format for any environment: a sequence of "My-Header=myValue" style
* expressions, with a request only mapped if each such header is found
* to have the given value. Expressions can be negated by using the "!=" operator,
* as in "My-Header!=myValue". "My-Header" style expressions are also supported,
* with such headers having to be present in the request (allowed to have
* any value). Finally, "!My-Header" style expressions indicate that the
* specified header is <i>not</i> supposed to be present in the request.
* <p>Also supports media type wildcards (*), for headers such as Accept
* and Content-Type. For instance,
* <pre class="code">
* &#064;RequestMapping(value = "/something", headers = "content-type=text/*")
* </pre>
* will match requests with a Content-Type of "text/html", "text/plain", etc.
* <p><b>Supported at the type level as well as at the method level!</b>
* When used at the type level, all method-level mappings inherit this
* header restriction.
* @see org.springframework.http.MediaType
*/
String[] headers() default {};
/**
* Narrows the primary mapping by media types that can be consumed by the
* mapped handler. Consists of one or more media types one of which must
* match to the request {@code Content-Type} header. Examples:
* <pre class="code">
* consumes = "text/plain"
* consumes = {"text/plain", "application/*"}
* consumes = MediaType.TEXT_PLAIN_VALUE
* </pre>
* Expressions can be negated by using the "!" operator, as in
* "!text/plain", which matches all requests with a {@code Content-Type}
* other than "text/plain".
* <p><b>Supported at the type level as well as at the method level!</b>
* If specified at both levels, the method level consumes condition overrides
* the type level condition.
* @see org.springframework.http.MediaType
* @see javax.servlet.http.HttpServletRequest#getContentType()
*/
String[] consumes() default {};
/**
* Narrows the primary mapping by media types that can be produced by the
* mapped handler. Consists of one or more media types one of which must
* be chosen via content negotiation against the "acceptable" media types
* of the request. Typically those are extracted from the {@code "Accept"}
* header but may be derived from query parameters, or other. Examples:
* <pre class="code">
* produces = "text/plain"
* produces = {"text/plain", "application/*"}
* produces = MediaType.TEXT_PLAIN_VALUE
* produces = "text/plain;charset=UTF-8"
* </pre>
* <p>If a declared media type contains a parameter (e.g. "charset=UTF-8",
* "type=feed", "type=entry") and if a compatible media type from the request
* has that parameter too, then the parameter values must match. Otherwise
* if the media type from the request does not contain the parameter, it is
* assumed the client accepts any value.
* <p>Expressions can be negated by using the "!" operator, as in "!text/plain",
* which matches all requests with a {@code Accept} other than "text/plain".
* <p><b>Supported at the type level as well as at the method level!</b>
* If specified at both levels, the method level produces condition overrides
* the type level condition.
* @see org.springframework.http.MediaType
*/
String[] produces() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface RequestMapping
{
RequestMethod[] method() default {};
String name() default "";
String[] consumes() default {};
String[] headers() default {};
String[] params() default {};
String[] path() default {};
String[] produces() default {};
String[] value() default {};
}

View File

@@ -1,6 +1,10 @@
// Generated automatically from org.springframework.web.bind.annotation.RequestMethod for testing purposes
package org.springframework.web.bind.annotation;
public enum RequestMethod {
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
}
public enum RequestMethod
{
DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, TRACE;
private RequestMethod() {}
}

View File

@@ -1,3 +1,5 @@
// Generated automatically from org.springframework.web.bind.annotation.RequestParam for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Documented;
@@ -5,19 +7,14 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RequestParam {
@AliasFor("name")
String value() default "";
@AliasFor("value")
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface RequestParam
{
String defaultValue() default "";
String name() default "";
boolean required() default true;
String defaultValue() default "\n\t\t\n\t\t\n\ue000\ue001\ue002\n\t\t\t\t\n";
String value() default "";
boolean required() default false;
}

View File

@@ -0,0 +1,20 @@
// Generated automatically from org.springframework.web.bind.annotation.RequestPart for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface RequestPart
{
String name() default "";
String value() default "";
boolean required() default false;
}

View File

@@ -0,0 +1,20 @@
// Generated automatically from org.springframework.web.bind.annotation.SessionAttribute for testing purposes
package org.springframework.web.bind.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface SessionAttribute
{
String name() default "";
String value() default "";
boolean required() default false;
}

View File

@@ -0,0 +1,10 @@
// Generated automatically from org.springframework.web.bind.support.SessionStatus for testing purposes
package org.springframework.web.bind.support;
public interface SessionStatus
{
boolean isComplete();
void setComplete();
}

View File

@@ -0,0 +1,13 @@
// Generated automatically from org.springframework.web.context.request.NativeWebRequest for testing purposes
package org.springframework.web.context.request;
import org.springframework.web.context.request.WebRequest;
public interface NativeWebRequest extends WebRequest
{
<T> T getNativeRequest(Class<T> p0);
<T> T getNativeResponse(Class<T> p0);
Object getNativeRequest();
Object getNativeResponse();
}

View File

@@ -0,0 +1,20 @@
// Generated automatically from org.springframework.web.context.request.RequestAttributes for testing purposes
package org.springframework.web.context.request;
public interface RequestAttributes
{
Object getAttribute(String p0, int p1);
Object getSessionMutex();
Object resolveReference(String p0);
String getSessionId();
String[] getAttributeNames(int p0);
static String REFERENCE_REQUEST = null;
static String REFERENCE_SESSION = null;
static int SCOPE_REQUEST = 0;
static int SCOPE_SESSION = 0;
void registerDestructionCallback(String p0, Runnable p1, int p2);
void removeAttribute(String p0, int p1);
void setAttribute(String p0, Object p1, int p2);
}

View File

@@ -0,0 +1,30 @@
// Generated automatically from org.springframework.web.context.request.WebRequest for testing purposes
package org.springframework.web.context.request;
import java.security.Principal;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import org.springframework.web.context.request.RequestAttributes;
public interface WebRequest extends RequestAttributes
{
Iterator<String> getHeaderNames();
Iterator<String> getParameterNames();
Locale getLocale();
Map<String, String[]> getParameterMap();
Principal getUserPrincipal();
String getContextPath();
String getDescription(boolean p0);
String getHeader(String p0);
String getParameter(String p0);
String getRemoteUser();
String[] getHeaderValues(String p0);
String[] getParameterValues(String p0);
boolean checkNotModified(String p0);
boolean checkNotModified(String p0, long p1);
boolean checkNotModified(long p0);
boolean isSecure();
boolean isUserInRole(String p0);
}

View File

@@ -1,329 +0,0 @@
/*
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.util;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.util.BitSet;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeSet;
import org.springframework.lang.Nullable;
/**
* Represents a MIME Type, as originally defined in RFC 2046 and subsequently
* used in other Internet protocols including HTTP.
*
* <p>This class, however, does not contain support for the q-parameters used
* in HTTP content negotiation. Those can be found in the subclass
* {@code org.springframework.http.MediaType} in the {@code spring-web} module.
*
* <p>Consists of a {@linkplain #getType() type} and a {@linkplain #getSubtype() subtype}.
* Also has functionality to parse MIME Type values from a {@code String} using
* {@link #valueOf(String)}. For more parsing options see {@link MimeTypeUtils}.
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @author Rossen Stoyanchev
* @author Sam Brannen
* @since 4.0
* @see MimeTypeUtils
*/
public class MimeType implements Comparable<MimeType>, Serializable {
protected static final String WILDCARD_TYPE = "";
/**
* Create a new {@code MimeType} for the given primary type.
* <p>The {@linkplain #getSubtype() subtype} is set to <code>"&#42;"</code>,
* and the parameters are empty.
* @param type the primary type
* @throws IllegalArgumentException if any of the parameters contains illegal characters
*/
public MimeType(String type) {
}
/**
* Create a new {@code MimeType} for the given primary type and subtype.
* <p>The parameters are empty.
* @param type the primary type
* @param subtype the subtype
* @throws IllegalArgumentException if any of the parameters contains illegal characters
*/
public MimeType(String type, String subtype) {
}
/**
* Create a new {@code MimeType} for the given type, subtype, and character set.
* @param type the primary type
* @param subtype the subtype
* @param charset the character set
* @throws IllegalArgumentException if any of the parameters contains illegal characters
*/
public MimeType(String type, String subtype, Charset charset) {
}
/**
* Copy-constructor that copies the type, subtype, parameters of the given {@code MimeType},
* and allows to set the specified character set.
* @param other the other MimeType
* @param charset the character set
* @throws IllegalArgumentException if any of the parameters contains illegal characters
* @since 4.3
*/
public MimeType(MimeType other, Charset charset) {
}
/**
* Copy-constructor that copies the type and subtype of the given {@code MimeType},
* and allows for different parameter.
* @param other the other MimeType
* @param parameters the parameters (may be {@code null})
* @throws IllegalArgumentException if any of the parameters contains illegal characters
*/
public MimeType(MimeType other, @Nullable Map<String, String> parameters) {
}
/**
* Create a new {@code MimeType} for the given type, subtype, and parameters.
* @param type the primary type
* @param subtype the subtype
* @param parameters the parameters (may be {@code null})
* @throws IllegalArgumentException if any of the parameters contains illegal characters
*/
public MimeType(String type, String subtype, @Nullable Map<String, String> parameters) {
}
/**
* Copy-constructor that copies the type, subtype and parameters of the given {@code MimeType},
* skipping checks performed in other constructors.
* @param other the other MimeType
* @since 5.3
*/
protected MimeType(MimeType other) {
}
protected void checkParameters(String parameter, String value) {
}
protected String unquote(String s) {
return null;
}
/**
* Indicates whether the {@linkplain #getType() type} is the wildcard character
* <code>&#42;</code> or not.
*/
public boolean isWildcardType() {
return false;
}
/**
* Indicates whether the {@linkplain #getSubtype() subtype} is the wildcard
* character <code>&#42;</code> or the wildcard character followed by a suffix
* (e.g. <code>&#42;+xml</code>).
* @return whether the subtype is a wildcard
*/
public boolean isWildcardSubtype() {
return false;
}
/**
* Indicates whether this MIME Type is concrete, i.e. whether neither the type
* nor the subtype is a wildcard character <code>&#42;</code>.
* @return whether this MIME Type is concrete
*/
public boolean isConcrete() {
return false;
}
/**
* Return the primary type.
*/
public String getType() {
return null;
}
/**
* Return the subtype.
*/
public String getSubtype() {
return null;
}
/**
* Return the subtype suffix as defined in RFC 6839.
* @since 5.3
*/
@Nullable
public String getSubtypeSuffix() {
return null;
}
/**
* Return the character set, as indicated by a {@code charset} parameter, if any.
* @return the character set, or {@code null} if not available
* @since 4.3
*/
@Nullable
public Charset getCharset() {
return null;
}
/**
* Return a generic parameter value, given a parameter name.
* @param name the parameter name
* @return the parameter value, or {@code null} if not present
*/
@Nullable
public String getParameter(String name) {
return null;
}
/**
* Return all generic parameter values.
* @return a read-only map (possibly empty, never {@code null})
*/
public Map<String, String> getParameters() {
return null;
}
/**
* Indicate whether this MIME Type includes the given MIME Type.
* <p>For instance, {@code text/*} includes {@code text/plain} and {@code text/html},
* and {@code application/*+xml} includes {@code application/soap+xml}, etc.
* This method is <b>not</b> symmetric.
* @param other the reference MIME Type with which to compare
* @return {@code true} if this MIME Type includes the given MIME Type;
* {@code false} otherwise
*/
public boolean includes(@Nullable MimeType other) {
return false;
}
/**
* Indicate whether this MIME Type is compatible with the given MIME Type.
* <p>For instance, {@code text/*} is compatible with {@code text/plain},
* {@code text/html}, and vice versa. In effect, this method is similar to
* {@link #includes}, except that it <b>is</b> symmetric.
* @param other the reference MIME Type with which to compare
* @return {@code true} if this MIME Type is compatible with the given MIME Type;
* {@code false} otherwise
*/
public boolean isCompatibleWith(@Nullable MimeType other) {
return false;
}
/**
* Similar to {@link #equals(Object)} but based on the type and subtype
* only, i.e. ignoring parameters.
* @param other the other mime type to compare to
* @return whether the two mime types have the same type and subtype
* @since 5.1.4
*/
public boolean equalsTypeAndSubtype(@Nullable MimeType other) {
return false;
}
/**
* Unlike {@link Collection#contains(Object)} which relies on
* {@link MimeType#equals(Object)}, this method only checks the type and the
* subtype, but otherwise ignores parameters.
* @param mimeTypes the list of mime types to perform the check against
* @return whether the list contains the given mime type
* @since 5.1.4
*/
public boolean isPresentIn(Collection<? extends MimeType> mimeTypes) {
return false;
}
@Override
public boolean equals(@Nullable Object other) {
return false;
}
/**
* Determine if the parameters in this {@code MimeType} and the supplied
* {@code MimeType} are equal, performing case-insensitive comparisons
* for {@link Charset Charsets}.
* @since 4.2
*/
private boolean parametersAreEqual(MimeType other) {
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return null;
}
protected void appendTo(StringBuilder builder) {
}
/**
* Compares this MIME Type to another alphabetically.
* @param other the MIME Type to compare to
* @see MimeTypeUtils#sortBySpecificity(List)
*/
@Override
public int compareTo(MimeType other) {
return 0;
}
/**
* Parse the given String value into a {@code MimeType} object,
* with this method name following the 'valueOf' naming convention
* (as supported by {@link org.springframework.core.convert.ConversionService}.
* @see MimeTypeUtils#parseMimeType(String)
*/
public static MimeType valueOf(String value) {
return null;
}
/**
* Comparator to sort {@link MimeType MimeTypes} in order of specificity.
*
* @param <T> the type of mime types that may be compared by this comparator
*/
public static class SpecificityComparator<T extends MimeType> implements Comparator<T> {
@Override
public int compare(T mimeType1, T mimeType2) {
return 0;
}
protected int compareParameters(T mimeType1, T mimeType2) {
return 0;
}
}
}

View File

@@ -0,0 +1,18 @@
// Generated automatically from org.springframework.web.servlet.mvc.support.RedirectAttributes for testing purposes
package org.springframework.web.servlet.mvc.support;
import java.util.Collection;
import java.util.Map;
import org.springframework.ui.Model;
public interface RedirectAttributes extends Model
{
Map<String, ? extends Object> getFlashAttributes();
RedirectAttributes addAllAttributes(Collection<? extends Object> p0);
RedirectAttributes addAttribute(Object p0);
RedirectAttributes addAttribute(String p0, Object p1);
RedirectAttributes addFlashAttribute(Object p0);
RedirectAttributes addFlashAttribute(String p0, Object p1);
RedirectAttributes mergeAttributes(Map<String, ? extends Object> p0);
}

View File

@@ -7,14 +7,12 @@ import java.net.URI;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import java.util.function.UnaryOperator;
import org.springframework.util.MultiValueMap;
import org.springframework.web.util.UriComponentsBuilder;
abstract public class UriComponents implements Serializable
{
protected UriComponents() {}
abstract UriComponents expandInternal(UriComponents.UriTemplateVariables p0);
protected UriComponents(String p0, String p1){}
protected abstract void copyToUriComponentsBuilder(UriComponentsBuilder p0);
public abstract List<String> getPathSegments();
@@ -36,8 +34,6 @@ abstract public class UriComponents implements Serializable
public final UriComponents expand(Map<String, ? extends Object> p0){ return null; }
public final UriComponents expand(Object... p0){ return null; }
public final UriComponents expand(UriComponents.UriTemplateVariables p0){ return null; }
static String expandUriComponent(String p0, UriComponents.UriTemplateVariables p1){ return null; }
static String expandUriComponent(String p0, UriComponents.UriTemplateVariables p1, UnaryOperator<String> p2){ return null; }
static public interface UriTemplateVariables
{
Object getValue(String p0);

View File

@@ -8,7 +8,6 @@ import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.util.MultiValueMap;
import org.springframework.web.util.UriBuilder;
@@ -16,7 +15,6 @@ import org.springframework.web.util.UriComponents;
public class UriComponentsBuilder implements Cloneable, UriBuilder
{
UriComponentsBuilder adaptFromForwardedHeaders(HttpHeaders p0){ return null; }
protected UriComponentsBuilder(){}
protected UriComponentsBuilder(UriComponentsBuilder p0){}
public Object clone(){ return null; }