private static int classDistance ( Class < ? > from , Class < ? > to , int current ) { return to . isAssignableFrom ( from ) ? to . equals ( from ) ? current : classDistance ( findAssignableAncestor ( from , to ) , to , current + 1 ) : - 1 ; }
Calculates distance between from and to classes counting from current .