Skip to content

Commit

Permalink
fixed files form Mockito #12
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 8b855ea commit f8831a8
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ public Class getGenericType(Field field) {
Type generic = field.getGenericType();
if (generic != null && generic instanceof ParameterizedType) {
Type actual = ((ParameterizedType) generic).getActualTypeArguments()[0];
if (actual instanceof Class) {
return (Class) actual;
} else if (actual instanceof ParameterizedType) {
//in case of nested generics we don't go deep
return (Class) ((ParameterizedType) actual).getRawType();
}
}

return Object.class;
Expand Down

0 comments on commit f8831a8

Please sign in to comment.