Search code examples
javagenericsjavadoc

Javadoc when extending generic class with non-generic class


Suppose I have two classes:

abstract class GenericA<E> {
    public void go(E e) {...}
}

public class IntegerA extends GenericA<Integer> {
}

Note that GenericA is package-private and generic, and IntegerA is public and not generic.

Now, when I generate the public Javadoc (using Eclipse), I see the following in the IntegerA methods section:

public void go(E e)

The problem is that a reader of that Javadoc has no idea what E is; i.e., that E represents Integer. I would rather have the Javadoc say

public void go(Integer e)

Is there a way to make Javadoc behave the way I want it to?


Solution

  • Only way I know is override method in IntegerA with Integer and then call super method.

     @Override
     public void go(Integer e) {
        super.go(e);
    }