Why ByteArrayOutputStream.close() throws IOException?
<p>Why <code>ByteArrayOutputStream</code>.<code>close</code> is declared with <code>throws IOException</code>?
First, de facto it can't throw anything, because its body is empty. Second, de jure it can't throw anything, because its documentation says "closing a ByteArrayOutputStream has no effect".</p>

<p>Isn't this (non-important, but still) a little mistake?</p>

<p>Yes, I understand that its superclass <code>OutputStream</code> implements <code>Closable</code>, the <code>close</code> method of which is allowed to throw <code>IOException</code>. But nobody forbids to override it (in <code>ByteArrayOutputStream</code>) with <code>close</code> method with no throw specification. (Even if overriding a more-throwing method with a less-throwing method was forbidden in some ancient versions of Java, changing <code>ByteArrayOutputStream</code>.<code>close</code> definition <em>now</em> won't be incompatible change.)</p>