@@ -91,7 +91,8 @@ public abstract class ReflectionUtils {
|
||||
while (!Object.class.equals(searchType) && searchType != null) {
|
||||
Field[] fields = searchType.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if ((name == null || name.equals(field.getName())) && (type == null || type.equals(field.getType()))) {
|
||||
if ((name == null || name.equals(field.getName())) &&
|
||||
(type == null || type.equals(field.getType()))) {
|
||||
return field;
|
||||
}
|
||||
}
|
||||
@@ -424,7 +425,8 @@ public abstract class ReflectionUtils {
|
||||
* @see java.lang.reflect.Field#setAccessible
|
||||
*/
|
||||
public static void makeAccessible(Field field) {
|
||||
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) ||
|
||||
if ((!Modifier.isPublic(field.getModifiers()) ||
|
||||
!Modifier.isPublic(field.getDeclaringClass().getModifiers()) ||
|
||||
Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
|
||||
field.setAccessible(true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -165,11 +165,11 @@ public class GenericTypeResolverTests {
|
||||
public void getGenericsOnArrayFromReturnCannotBeResolved() throws Exception {
|
||||
// SPR-11044
|
||||
Class<?> resolved = GenericTypeResolver.resolveReturnType(
|
||||
WithArrayBase.class.getDeclaredMethod("array", Object[].class),
|
||||
WithArray.class);
|
||||
WithArrayBase.class.getDeclaredMethod("array", Object[].class), WithArray.class);
|
||||
assertThat(resolved, equalTo((Class) Object[].class));
|
||||
}
|
||||
|
||||
|
||||
public interface MyInterfaceType<T> {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user