Tuesday, July 10, 2007

Refactor javadoc params: Consider the following javadoc:


/**
* If foo is prime, that's good.
* @param foo Bla bla bla.
*/
public void do(int foo) { ... }


If you refactor/rename the parameter "foo" (with Shift-F6), the second word in the javadoc won't get changed. To fix that, just write it as {@code foo} instead!


/**
* If {@code foo} is prime, that's good.
* @param foo Bla bla bla.
*/
public void do(int foo) { ... }