eclipsejavadocinheritdoc

{@inheritDoc} not inheriting superclass javadoc in Eclipse


When I use {@inheritDoc} in Eclipse, the superclass' javadoc comments are not appearing in my class' javadoc.

I have the following piece of code:

import javax.swing.table.AbstractTableModel;

public class TestTableModel extends AbstractTableModel {

  /**
   * {@inheritDoc}
   */
  @Override
  public int getRowCount() {
    return 1;
  }

  @Override
  public Object getValueAt(int rowIndex, int columnIndex) {
    return null;
  }

  @Override
  public int getColumnCount() {
    return 0;
  }
}

I make sure that rt.jar library (which contains javax.swing.table.AbstractTableModel) has source code and javadoc locations set, and indeed when I hover over getRowCount() I get the AbstractTableModel javadoc in a tool tip. When I generate the javadoc from Eclipse, I make sure that in the "referenced archives and projects" section that rt.jar is selected. But the inherit doc does not work.


Solution

  • It looks like the superclass's source (in this case AbstractTableModel.java) must be on the sourcepath of javadoc. This is done in Eclipse by creating a project for AbstractTableModel and selecting it in the "Select types for which Javadoc will be generated" selection during javadoc generation.