I don;t quite understand where I can throw this exception.
For instance, I'm implementing the Future<T>
interface and don't want anyone calls the method:
So, can I just throw the UnsupportedOperationException
?
public T get(long timeout, TimeUnit unit){
throw new UnsupportedOperationException();
}
The thing is the specification of the method doesn't say anything about throwing the Exception. The Exception, in turn
throws to indicate that the requested operation is not supported.
Class UnsupportedOperationException
I mean, is it common to throw it if you don't want it to be called or it may be considered incorrect because not all methods've been implemented? In my specific case, I don't think that calling the method would make sense...