removed unused variable. eliminated unnecessary ObjTypePair creation.
This commit is contained in:
parent
4d9bec2206
commit
ad921a0ee8
@ -79,6 +79,13 @@ final class ObjectTypePair {
|
||||
return new ObjectTypePair(obj, actualType, preserveType);
|
||||
}
|
||||
|
||||
Type getMoreSpecificType() {
|
||||
if (preserveType || obj == null) {
|
||||
return type;
|
||||
}
|
||||
return getActualTypeIfMoreSpecific(type, obj.getClass());
|
||||
}
|
||||
|
||||
// This takes care of situations where the field was declared as an Object, but the
|
||||
// actual value contains something more specific. See Issue 54.
|
||||
// TODO (inder): This solution will not work if the field is of a generic type, but
|
||||
|
@ -54,9 +54,7 @@ final class ReflectingFieldNavigator {
|
||||
* @param visitor the visitor to visit each field with
|
||||
*/
|
||||
void visitFieldsReflectively(ObjectTypePair objTypePair, Visitor visitor) {
|
||||
ObjectTypePair currObjTypePair = objTypePair.toMoreSpecificType();
|
||||
Class<?> topLevelClass = Types.getRawType(currObjTypePair.type);
|
||||
for (Class<?> curr : getInheritanceHierarchy(currObjTypePair.type)) {
|
||||
for (Class<?> curr : getInheritanceHierarchy(objTypePair.getMoreSpecificType())) {
|
||||
navigateClassFields(objTypePair.getObject(), objTypePair.type, curr, visitor);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user