formatDoc method optimization : only one method for JavaClass and javaMethod objects