I note that StringBuilder indirectly implements Appendable.
Appendable.append(CharSequence) throws the checked exception IOException. So how does AbstractStringBuilder.append(CharSequence) get away with not declaring IOException? Consequently, how is it that I never have to worry about IOException when I append to a StringBuilder?
Is this some odd exception just for existing classes that have been retrofitted for Appendable, or am I forgetting part of my basic Java rules?
AbstractStringBuldercan throw at most anIOExceptionor lower (more specific, subclass ofIOException). The JLS 8.4.8.3. Requirements in Overriding and Hiding for that:"... a method declaration m2 in B overrides or hides a method declaration m1 in A. Then: If m2 has a throws clause that mentions any checked exception types, then m1 must have a throws clause, or a compile-time error occurs..."Appendableyou will have to