Clean up warnings in spring-core
This commit is contained in:
parent
8f4fb207d7
commit
8a94077da0
|
@ -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];
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.core;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -43,16 +42,6 @@ import static org.junit.Assert.*;
|
|||
@SuppressWarnings("rawtypes")
|
||||
public class BridgeMethodResolverTests {
|
||||
|
||||
private static TypeVariable<?> findTypeVariable(Class<?> clazz, String name) {
|
||||
TypeVariable<?>[] variables = clazz.getTypeParameters();
|
||||
for (TypeVariable<?> variable : variables) {
|
||||
if (variable.getName().equals(name)) {
|
||||
return variable;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Method findMethodWithReturnType(String name, Class<?> returnType, Class<SettingsDaoImpl> targetType) {
|
||||
Method[] methods = targetType.getMethods();
|
||||
for (Method m : methods) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core.convert.support;
|
||||
|
||||
import java.time.Duration;
|
||||
|
@ -22,7 +23,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
import io.reactivex.Flowable;
|
||||
import io.reactivex.Maybe;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
@ -50,13 +50,7 @@ import static org.junit.Assert.assertTrue;
|
|||
@SuppressWarnings("unchecked")
|
||||
public class ReactiveAdapterRegistryTests {
|
||||
|
||||
private ReactiveAdapterRegistry registry;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
this.registry = new ReactiveAdapterRegistry();
|
||||
}
|
||||
private final ReactiveAdapterRegistry registry = new ReactiveAdapterRegistry();
|
||||
|
||||
|
||||
@Test
|
||||
|
@ -137,7 +131,7 @@ public class ReactiveAdapterRegistryTests {
|
|||
Publisher<Integer> source = Flowable.fromIterable(sequence);
|
||||
Object target = getAdapter(rx.Observable.class).fromPublisher(source);
|
||||
assertTrue(target instanceof rx.Observable);
|
||||
assertEquals(sequence, ((rx.Observable) target).toList().toBlocking().first());
|
||||
assertEquals(sequence, ((rx.Observable<?>) target).toList().toBlocking().first());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -162,7 +156,7 @@ public class ReactiveAdapterRegistryTests {
|
|||
Publisher<Integer> source = Flux.fromIterable(sequence);
|
||||
Object target = getAdapter(io.reactivex.Flowable.class).fromPublisher(source);
|
||||
assertTrue(target instanceof io.reactivex.Flowable);
|
||||
assertEquals(sequence, ((io.reactivex.Flowable) target).toList().blockingGet());
|
||||
assertEquals(sequence, ((io.reactivex.Flowable<?>) target).toList().blockingGet());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -171,7 +165,7 @@ public class ReactiveAdapterRegistryTests {
|
|||
Publisher<Integer> source = Flowable.fromIterable(sequence);
|
||||
Object target = getAdapter(io.reactivex.Observable.class).fromPublisher(source);
|
||||
assertTrue(target instanceof io.reactivex.Observable);
|
||||
assertEquals(sequence, ((io.reactivex.Observable) target).toList().blockingGet());
|
||||
assertEquals(sequence, ((io.reactivex.Observable<?>) target).toList().blockingGet());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -251,7 +245,7 @@ public class ReactiveAdapterRegistryTests {
|
|||
|
||||
@Test
|
||||
public void CompletableFutureToPublisher() throws Exception {
|
||||
CompletableFuture<Integer> future = new CompletableFuture();
|
||||
CompletableFuture<Integer> future = new CompletableFuture<>();
|
||||
future.complete(1);
|
||||
Object target = getAdapter(CompletableFuture.class).toPublisher(future);
|
||||
assertTrue("Expected Mono Publisher: " + target.getClass().getName(), target instanceof Mono);
|
||||
|
|
|
@ -104,7 +104,6 @@ public class LinkedCaseInsensitiveMapTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void mapClone() {
|
||||
map.put("key", "value1");
|
||||
LinkedCaseInsensitiveMap<String> copy = map.clone();
|
||||
|
|
Loading…
Reference in New Issue