Why not have StringBuilder and StringBuffer implement a common interface?
The differences between [`StringBuilder`](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html) and [`StringBuffer`](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuffer.html) in Java are well documented and have been [touched upon in StackOverflow](http://stackoverflow.com/q/355089/507519) as well.

Basically, `StringBuilder` is a non-synchronized copy of `StringBuffer`, with pretty much the same interface since it was intended as a faster drop-in replacement for `StringBuffer`. Their API is practically identical and they are actually subclasses of the same *inaccessible* abstract class in the current JDK.

The one thing I wonder about, therefore, is why they are not *publicly related*. Having both classes implement a common interface or even having `StringBuffer` as a subclass of `StringBuilder` would make sense, allowing the existence of shared code for both classes.

So why this forced separation? Was it so that programmers would not inadvertently mix thread-safe with thread-unsafe code? Or was it just a design oversight that will now be inherited to the end of eternity?
Why not have StringBuilder and StringBuffer implement a common interface?
===

The differences between [`StringBuilder`](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html) and [`StringBuffer`](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuffer.html) in Java are well documented and have been [touched upon in StackOverflow](http://stackoverflow.com/q/355089/507519) as well.

Basically, `StringBuilder` is a non-synchronized copy of `StringBuffer`, with pretty much the same interface since it was intended as a faster drop-in replacement for `StringBuffer`. Their API is practically identical and they are actually subclasses of the same *inaccessible* abstract class in the current JDK.

The one thing I wonder about, therefore, is why they are not *publicly related*. Having both classes implement a common interface or even having `StringBuffer` as a subclass of `StringBuilder` would make sense, allowing the existence of shared code for both classes.

So why this forced separation? Was it so that programmers would not inadvertently mix thread-safe with thread-unsafe code? Or was it just a design oversight that will now be inherited to the end of eternity?