Search code examples
javajavadoc

What changes to javadoc should be made when renaming a class?


Say I have a class, and I renamed it. How should i change the documentation of the class? This is what the the javadoc of the class currently looks like

/**
 * Single report.
 *
 * <p>There is no thread-safety guarantee.
 *
 * @author Yegor Bugayenko (yegor256@gmail.com)
 * @version $Id: 532ae3783f6bcb7ffa6819b91ebee78670aa82e3 $
 * @since 0.1
 * @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
 * @checkstyle JavadocTagsCheck (500 lines)
 */

Solution

  • If the change only affects the name of the class, only the name occurrences in documentation, configuration and other references need to be replaced accordingly. As the JavaDoc does not contain any class names, there's nothing to do in that particular place.

    IDE's like IntelliJ or Eclipse can help a lot when doing refactorings like that because they offer tools to perform the replace in a safe and convenient way. In simple cases a text editor with search and replace functionality might suffice.

    After an automatic replace I'd go through all the changes manually and double check if they had the intended affect as sometimes the context is affected from the change as well and needs to be adapted.