Clean up warnings in spring-core

This commit is contained in:
Sam Brannen
2017-10-15 18:28:08 +02:00
parent 8f4fb207d7
commit 8a94077da0
6 changed files with 10 additions and 29 deletions

View File

@@ -182,7 +182,7 @@ public class MethodParameter {
*/
@Nullable
public Constructor<?> getConstructor() {
return (this.executable instanceof Constructor ? (Constructor) this.executable : null);
return (this.executable instanceof Constructor ? (Constructor<?>) this.executable : null);
}
/**
@@ -586,7 +586,7 @@ public class MethodParameter {
parameterNames = discoverer.getParameterNames((Method) this.executable);
}
else if (this.executable instanceof Constructor) {
parameterNames = discoverer.getParameterNames((Constructor) this.executable);
parameterNames = discoverer.getParameterNames((Constructor<?>) this.executable);
}
if (parameterNames != null) {
this.parameterName = parameterNames[this.parameterIndex];

View File

@@ -251,7 +251,6 @@ public class TypeDescriptor implements Serializable {
* @param annotationType the annotation type
* @return the annotation, or {@code null} if no such annotation exists on this type descriptor
*/
@SuppressWarnings("unchecked")
@Nullable
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
if (this.annotatedElement.isEmpty()) {

View File

@@ -76,7 +76,7 @@ final class ObjectToOptionalConverter implements ConditionalGenericConverter {
else if (targetType.getResolvableType().hasGenerics()) {
Object target = this.conversionService.convert(source, sourceType, new GenericTypeDescriptor(targetType));
if (target == null || (target.getClass().isArray() && Array.getLength(target) == 0) ||
(target instanceof Collection && ((Collection) target).isEmpty())) {
(target instanceof Collection && ((Collection<?>) target).isEmpty())) {
return Optional.empty();
}
return Optional.of(target);