Batman
Batman

Reputation: 1324

Javadoc and inherited classes

In my workplace, I was looking at a Javadoc and found that for a specific method, the return value is x, while in real is y(class y inherited class x).

What do you think ? I asked the designers, and they told me that because that x includes in y, it is not matter if u return x or y if in Javadoc it should be return x... I think it's wrong because of two: 1. The user should be aware of the real object he gets even if the instances remain the same. 2. The user should not have access to instances he shouldn't need to be accessed to.

Upvotes: 0

Views: 60

Answers (1)

Erwin Smout
Erwin Smout

Reputation: 18408

You can declare return type y in the subclass method, and if you do [I expect] javadoc will reflect that.

Upvotes: 1

Related Questions