Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…amework into read_yuyang

* 'master' of https://github.com/spring-projects/spring-framework: (32 commits)
  Polishing
  Add missing backtick in WebSocket documentation
  Hoist Class.getName() from String concatenation to dodge an issue related to profile pollution
  Support variable resolution of wildcard types
  Test status quo for @inherited annotation support in AnnotationMetadata
  Polishing
  Add @SInCE tags to firstElement methods
  Add firstElement to CollectionUtils
  Fix status code in webflux.adoc
  Consistently use releaseBody in DefaultWebClient
  Replace ReadCancellationException with takeWhile
  Add UriUtils.encodeQueryParams
  Remove mismatched marker in core-beans.adoc
  Add integration test for spring-projectsgh-24110
  Honor default values for implicit aliases in composed annotations
  Next Development Version
  Polish
  Provide default codecs config callback to custom codecs
  [*.*] is displayed as [bold .] and needs to be escaped
  Polishing (follow-up on acfeb7)
  ...
  • Loading branch information
yuyang committed Dec 7, 2019
2 parents 7b70670 + de8a6c8 commit bd66c5d
Show file tree
Hide file tree
Showing 49 changed files with 819 additions and 327 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ configure(allprojects) { project ->

dependency "com.google.code.findbugs:jsr305:3.0.2"

dependencySet(group: 'org.aspectj', version: '1.9.4') {
dependencySet(group: 'org.aspectj', version: '1.9.5') {
entry 'aspectjrt'
entry 'aspectjtools'
entry 'aspectjweaver'
Expand All @@ -84,13 +84,13 @@ configure(allprojects) { project ->
exclude group: "stax", name: "stax-api"
}
dependency "com.google.code.gson:gson:2.8.6"
dependency "com.google.protobuf:protobuf-java-util:3.10.0"
dependency "com.google.protobuf:protobuf-java-util:3.11.0"
dependency "com.googlecode.protobuf-java-format:protobuf-java-format:1.4"
dependency("com.thoughtworks.xstream:xstream:1.4.11.1") {
exclude group: "xpp3", name: "xpp3_min"
exclude group: "xmlpull", name: "xmlpull"
}
dependency "org.apache.johnzon:johnzon-jsonb:1.2.1"
dependency "org.apache.johnzon:johnzon-jsonb:1.2.2"
dependency("org.codehaus.jettison:jettison:1.3.8") {
exclude group: "stax", name: "stax-api"
}
Expand Down Expand Up @@ -201,7 +201,7 @@ configure(allprojects) { project ->
exclude group: "org.hamcrest", name: "hamcrest-core"
}
}
dependencySet(group: 'org.mockito', version: '3.1.0') {
dependencySet(group: 'org.mockito', version: '3.2.0') {
entry('mockito-core') {
exclude group: "org.hamcrest", name: "hamcrest-core"
}
Expand Down Expand Up @@ -338,7 +338,7 @@ configure([rootProject] + javaProjects) { project ->
}

checkstyle {
toolVersion = "8.26"
toolVersion = "8.27"
configDir = rootProject.file("src/checkstyle")
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=5.2.2.BUILD-SNAPSHOT
version=5.2.3.BUILD-SNAPSHOT
org.gradle.jvmargs=-Xmx1536M
org.gradle.caching=true
org.gradle.parallel=true
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pluginManagement {
maven { url 'https://repo.spring.io/plugins-release' }
}
}
enableFeaturePreview("GRADLE_METADATA")
apply from: "$rootDir/gradle/build-cache-settings.gradle"

include "spring-aop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throw
* @return the description
*/
protected String getInvocationDescription(MethodInvocation invocation) {
return "method '" + invocation.getMethod().getName() + "' of class [" +
invocation.getThis().getClass().getName() + "]";
String className = invocation.getThis().getClass().getName();
return "method '" + invocation.getMethod().getName() + "' of class [" + className + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
return null;
}
}
String editorName = targetType.getName() + "Editor";
String targetTypeName = targetType.getName();
String editorName = targetTypeName + "Editor";
try {
Class<?> editorClass = cl.loadClass(editorName);
if (!PropertyEditor.class.isAssignableFrom(editorClass)) {
Expand All @@ -539,7 +540,7 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
catch (ClassNotFoundException ex) {
if (logger.isTraceEnabled()) {
logger.trace("No property editor [" + editorName + "] found for type " +
targetType.getName() + " according to 'Editor' suffix convention");
targetTypeName + " according to 'Editor' suffix convention");
}
unknownEditorTypes.add(targetType);
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* 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.
Expand Down Expand Up @@ -41,8 +41,8 @@

/**
* Decorator for a standard {@link BeanInfo} object, e.g. as created by
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register static
* and/or non-void returning setter methods. For example:
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register
* static and/or non-void returning setter methods. For example:
*
* <pre class="code">
* public class Bean {
Expand Down Expand Up @@ -487,7 +487,7 @@ public void setPropertyEditorClass(@Nullable Class<?> propertyEditorClass) {
}

/*
* See java.beans.IndexedPropertyDescriptor#equals(java.lang.Object)
* See java.beans.IndexedPropertyDescriptor#equals
*/
@Override
public boolean equals(@Nullable Object other) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreExce
* @return the number of bean definitions found
* @throws BeanDefinitionStoreException in case of loading or parsing errors
*/
@SuppressWarnings("rawtypes")
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
// Check for XML files and redirect them to the "standard" XmlBeanDefinitionReader
String filename = encodedResource.getResource().getFilename();
Expand All @@ -245,10 +244,10 @@ public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefin
}

@SuppressWarnings("serial")
Closure beans = new Closure(this) {
Closure<Object> beans = new Closure<Object>(this) {
@Override
public Object call(Object... args) {
invokeBeanDefiningClosure((Closure) args[0]);
invokeBeanDefiningClosure((Closure<?>) args[0]);
return null;
}
};
Expand Down Expand Up @@ -290,8 +289,7 @@ public void setVariable(String name, Object value) {
* @param closure the block or closure
* @return this {@code GroovyBeanDefinitionReader} instance
*/
@SuppressWarnings("rawtypes")
public GroovyBeanDefinitionReader beans(Closure closure) {
public GroovyBeanDefinitionReader beans(Closure<?> closure) {
return invokeBeanDefiningClosure(closure);
}

Expand All @@ -312,29 +310,25 @@ public GenericBeanDefinition bean(Class<?> type) {
* @param args the constructors arguments and closure configurer
* @return the bean definition
*/
@SuppressWarnings("rawtypes")
public AbstractBeanDefinition bean(Class<?> type, Object...args) {
GroovyBeanDefinitionWrapper current = this.currentBeanDefinition;
try {
Closure callable = null;
Collection constructorArgs = null;
Closure<?> callable = null;
Collection<Object> constructorArgs = null;
if (!ObjectUtils.isEmpty(args)) {
int index = args.length;
Object lastArg = args[index - 1];
if (lastArg instanceof Closure) {
callable = (Closure) lastArg;
if (lastArg instanceof Closure<?>) {
callable = (Closure<?>) lastArg;
index--;
}
if (index > -1) {
constructorArgs = resolveConstructorArguments(args, 0, index);
}
constructorArgs = resolveConstructorArguments(args, 0, index);
}
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(null, type, constructorArgs);
if (callable != null) {
callable.call(this.currentBeanDefinition);
}
return this.currentBeanDefinition.getBeanDefinition();

}
finally {
this.currentBeanDefinition = current;
Expand Down Expand Up @@ -381,11 +375,10 @@ public void importBeans(String resourcePattern) throws IOException {
* takes a class argument.
*/
@Override
@SuppressWarnings("rawtypes")
public Object invokeMethod(String name, Object arg) {
Object[] args = (Object[])arg;
if ("beans".equals(name) && args.length == 1 && args[0] instanceof Closure) {
return beans((Closure) args[0]);
return beans((Closure<?>) args[0]);
}
else if ("ref".equals(name)) {
String refName;
Expand Down Expand Up @@ -435,14 +428,13 @@ private boolean addDeferredProperty(String property, Object newValue) {
return false;
}

@SuppressWarnings("rawtypes")
private void finalizeDeferredProperties() {
for (DeferredProperty dp : this.deferredProperties.values()) {
if (dp.value instanceof List) {
dp.value = manageListIfNecessary((List) dp.value);
dp.value = manageListIfNecessary((List<?>) dp.value);
}
else if (dp.value instanceof Map) {
dp.value = manageMapIfNecessary((Map) dp.value);
dp.value = manageMapIfNecessary((Map<?, ?>) dp.value);
}
dp.apply();
}
Expand All @@ -454,8 +446,7 @@ else if (dp.value instanceof Map) {
* @param callable the closure argument
* @return this {@code GroovyBeanDefinitionReader} instance
*/
@SuppressWarnings("rawtypes")
protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure callable) {
protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure<?> callable) {
callable.setDelegate(this);
callable.call();
finalizeDeferredProperties();
Expand All @@ -469,7 +460,6 @@ protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure callable)
* argument is sometimes a closure. All the arguments in between are constructor arguments.
* @return the bean definition wrapper
*/
@SuppressWarnings("rawtypes")
private GroovyBeanDefinitionWrapper invokeBeanDefiningMethod(String beanName, Object[] args) {
boolean hasClosureArgument = (args[args.length - 1] instanceof Closure);
if (args[0] instanceof Class) {
Expand All @@ -495,9 +485,10 @@ else if (args[0] instanceof RuntimeBeanReference) {
else if (args[0] instanceof Map) {
// named constructor arguments
if (args.length > 1 && args[1] instanceof Class) {
List<Object> constructorArgs = resolveConstructorArguments(args, 2, hasClosureArgument ? args.length - 1 : args.length);
List<Object> constructorArgs =
resolveConstructorArguments(args, 2, hasClosureArgument ? args.length - 1 : args.length);
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, (Class<?>) args[1], constructorArgs);
Map namedArgs = (Map) args[0];
Map<?, ?> namedArgs = (Map<?, ?>) args[0];
for (Object o : namedArgs.keySet()) {
String propName = (String) o;
setProperty(propName, namedArgs.get(propName));
Expand All @@ -507,7 +498,7 @@ else if (args[0] instanceof Map) {
else {
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName);
// First arg is the map containing factoryBean : factoryMethod
Map.Entry factoryBeanEntry = (Map.Entry) ((Map) args[0]).entrySet().iterator().next();
Map.Entry<?, ?> factoryBeanEntry = ((Map<?, ?>) args[0]).entrySet().iterator().next();
// If we have a closure body, that will be the last argument.
// In between are the constructor args
int constructorArgsTest = (hasClosureArgument ? 2 : 1);
Expand All @@ -531,12 +522,13 @@ else if (args[0] instanceof Closure) {
this.currentBeanDefinition.getBeanDefinition().setAbstract(true);
}
else {
List constructorArgs = resolveConstructorArguments(args, 0, hasClosureArgument ? args.length - 1 : args.length);
List<Object> constructorArgs =
resolveConstructorArguments(args, 0, hasClosureArgument ? args.length - 1 : args.length);
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, null, constructorArgs);
}

if (hasClosureArgument) {
Closure callable = (Closure) args[args.length - 1];
Closure<?> callable = (Closure<?>) args[args.length - 1];
callable.setDelegate(this);
callable.setResolveStrategy(Closure.DELEGATE_FIRST);
callable.call(this.currentBeanDefinition);
Expand All @@ -549,18 +541,17 @@ else if (args[0] instanceof Closure) {
return beanDefinition;
}

@SuppressWarnings("rawtypes")
protected List<Object> resolveConstructorArguments(Object[] args, int start, int end) {
Object[] constructorArgs = Arrays.copyOfRange(args, start, end);
for (int i = 0; i < constructorArgs.length; i++) {
if (constructorArgs[i] instanceof GString) {
constructorArgs[i] = constructorArgs[i].toString();
}
else if (constructorArgs[i] instanceof List) {
constructorArgs[i] = manageListIfNecessary((List) constructorArgs[i]);
constructorArgs[i] = manageListIfNecessary((List<?>) constructorArgs[i]);
}
else if (constructorArgs[i] instanceof Map){
constructorArgs[i] = manageMapIfNecessary((Map) constructorArgs[i]);
constructorArgs[i] = manageMapIfNecessary((Map<?, ?>) constructorArgs[i]);
}
}
return Arrays.asList(constructorArgs);
Expand Down Expand Up @@ -621,7 +612,6 @@ public void setProperty(String name, Object value) {
}
}

@SuppressWarnings("rawtypes")
protected void applyPropertyToBeanDefinition(String name, Object value) {
if (value instanceof GString) {
value = value.toString();
Expand All @@ -632,7 +622,7 @@ protected void applyPropertyToBeanDefinition(String name, Object value) {
else if (value instanceof Closure) {
GroovyBeanDefinitionWrapper current = this.currentBeanDefinition;
try {
Closure callable = (Closure) value;
Closure<?> callable = (Closure<?>) value;
Class<?> parameterType = callable.getParameterTypes()[0];
if (Object.class == parameterType) {
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper("");
Expand Down Expand Up @@ -833,8 +823,8 @@ public boolean add(Object value) {
return retVal;
}

@SuppressWarnings({ "rawtypes", "unused" })
public boolean addAll(Collection values) {
@SuppressWarnings("unused")
public boolean addAll(Collection<?> values) {
boolean retVal = (Boolean) InvokerHelper.invokeMethod(this.propertyValue, "addAll", values);
for (Object value : values) {
updateDeferredProperties(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* 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.
Expand Down Expand Up @@ -173,7 +173,6 @@ else if (dynamicProperties.contains(property)) {
}

@Override
@SuppressWarnings("rawtypes")
public void setProperty(String property, Object newValue) {
if (PARENT.equals(property)) {
setParent(newValue);
Expand All @@ -197,7 +196,7 @@ else if (Boolean.TRUE.equals(newValue)) {
// constructorArgs
else if (CONSTRUCTOR_ARGS.equals(property) && newValue instanceof List) {
ConstructorArgumentValues cav = new ConstructorArgumentValues();
List args = (List) newValue;
List<?> args = (List<?>) newValue;
for (Object arg : args) {
cav.addGenericArgumentValue(arg);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* 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.
Expand Down Expand Up @@ -110,7 +110,6 @@ public Connection getConnection() throws SQLException {
public void shutdown() {
// Do nothing - a Spring-managed DataSource has its own lifecycle.
}
/* Quartz 2.2 initialize method */
@Override
public void initialize() {
// Do nothing - a Spring-managed DataSource has its own lifecycle.
Expand Down Expand Up @@ -139,7 +138,6 @@ public Connection getConnection() throws SQLException {
public void shutdown() {
// Do nothing - a Spring-managed DataSource has its own lifecycle.
}
/* Quartz 2.2 initialize method */
@Override
public void initialize() {
// Do nothing - a Spring-managed DataSource has its own lifecycle.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* 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.
Expand Down Expand Up @@ -81,8 +81,8 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
return ClassUtils.forName(name, this.resourceLoader.getClassLoader());
}

@Override
@SuppressWarnings("unchecked")
@Override
public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws ClassNotFoundException {
return (Class<? extends T>) loadClass(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,12 @@ private ResolvableType resolveVariable(TypeVariable<?> variable) {
return forType(ownerType, this.variableResolver).resolveVariable(variable);
}
}
if (this.type instanceof WildcardType) {
ResolvableType resolved = resolveType().resolveVariable(variable);
if (resolved != null) {
return resolved;
}
}
if (this.variableResolver != null) {
return this.variableResolver.resolveVariable(variable);
}
Expand Down
Loading

0 comments on commit bd66c5d

Please sign in to comment.