Reputation: 1000
I have a method defined in the superclass that I don't implement this method in my extending class:
@Override
public String[] getParams() {
throw new UnsupportedOperationException("Not implemented");
}
My doubt is what to write as Javadoc. Usually, if the method is implemented, we would just use a simple:
/** {@inheritDoc} */
But I want to explicitly comment that the method is not implemented and should not be used. What would you write here?
Maybe:
/**
* Method not implemented
* {@inheritDoc} */
Or maybe:
/**
* Not implemented.
*
* @throws UnsupportedOperationException.
*/
Upvotes: 3
Views: 3216
Reputation: 41223
There is no universal standard, but you could imitate what the Guava developers have done with unsupported operations on immutable collections. e.g. from com.google.common.collect.ImmutableList.java
:
/**
* Guaranteed to throw an exception and leave the list unmodified.
*
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@CanIgnoreReturnValue
@Deprecated
@Override
public final E set(int index, E element) {
throw new UnsupportedOperationException();
}
I would say that @inheritDoc
should not be used, because it probably describes some behaviour which your exception-throwing implementation does not
do.
(@CanIgnoreReturnValue
is from the ErrorProne
library -- I don't think it's particularly relevant to what we're talking about, but I left it in rather than modify the code I'm quoting)
Upvotes: 2