Safer docgen in the presence of generics
merge bug25706 into default