change logic to always give objects the highest value
This commit is contained in:
		| @@ -23,6 +23,10 @@ public final class ReflectionUtil { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static int getCastDepth(Class<?> child, Class<?> parent) { |     public static int getCastDepth(Class<?> child, Class<?> parent) { | ||||||
|  |  | ||||||
|  |         if (parent.equals(Object.class)) | ||||||
|  |             return Integer.MAX_VALUE; | ||||||
|  |  | ||||||
|         if (!parent.isAssignableFrom(child)) { |         if (!parent.isAssignableFrom(child)) { | ||||||
|             throw new IllegalArgumentException("The specified class is not a child class of the specified parent."); |             throw new IllegalArgumentException("The specified class is not a child class of the specified parent."); | ||||||
|         } |         } | ||||||
| @@ -77,7 +81,7 @@ public final class ReflectionUtil { | |||||||
|         Class<?> currMostSpecific = null; |         Class<?> currMostSpecific = null; | ||||||
|         for (Class<?> currClass : classes) { |         for (Class<?> currClass : classes) { | ||||||
|             int currCastDepth = getCastDepth(base, currClass); |             int currCastDepth = getCastDepth(base, currClass); | ||||||
|             if (currCastDepth < min) { |             if (currCastDepth <= min) { | ||||||
|                 min = currCastDepth; |                 min = currCastDepth; | ||||||
|                 currMostSpecific = currClass; |                 currMostSpecific = currClass; | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user