Javadoc when extending generic class with non-generic class

北城余情 提交于 2019-12-10 04:30:25

问题


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?


回答1:


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);
}


来源:https://stackoverflow.com/questions/12697076/javadoc-when-extending-generic-class-with-non-generic-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!