Change return type of setField(..) from Object to T.

Annotate makeAccessibleReturnConstructor(:Constructor) with @SuppresssWarnings('rawtypes').
This commit is contained in:
John Blum
2020-07-26 20:55:05 -07:00
parent a2bc65b408
commit 9c693001fd

View File

@@ -54,6 +54,7 @@ public abstract class ReflectionUtils extends org.springframework.util.Reflectio
fieldName, target.getClass().getName())));
}
@SuppressWarnings("rawtypes")
public static Constructor makeAccessibleReturnConstructor(Constructor constructor) {
makeAccessible(constructor);
return constructor;
@@ -69,7 +70,7 @@ public abstract class ReflectionUtils extends org.springframework.util.Reflectio
return method;
}
public static <T> Object setField(T target, String fieldName, Object value) throws NoSuchFieldException {
public static <T> T setField(T target, String fieldName, Object value) throws NoSuchFieldException {
Assert.notNull(target, "Target object must not be null");
Assert.hasText(fieldName, String.format("Field name [%s] must be specified", fieldName));