RFR: JDK-8304945: StringBuilder and StringBuffer should implement Appendable explicitly
Joe Darcy
darcy at openjdk.org
Mon Apr 3 17:23:08 UTC 2023
On Sun, 2 Apr 2023 07:45:23 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> The StringBuilder and StringBuffer classes are Appendable by virtue of from subclasses their non-public superclass AbstractStringBuilder.
>>
>> It is slightly clearer to declare StringBuilder and StringBuffer to directly implement Appendable, as they already directly implement the CharSequence interface also implemented by their superclass.
>>
>> There are no other interfaces implemented by AbstractStringBuilder other than Appendable and CharSequence.
>>
>> Please also review the CSR https://bugs.openjdk.org/browse/JDK-8305408
>
> src/java.base/share/classes/java/lang/StringBuilder.java line 93:
>
>> 91: public final class StringBuilder
>> 92: extends AbstractStringBuilder
>> 93: implements Appendable, java.io.Serializable, Comparable<StringBuilder>, CharSequence
>
> Not an issue here, just wondering why do we have lots of places where we use `java.io.Serializable` instead of import statement?
The JDK codebase historically has not used tooling to enforce a uniform style on such matters.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13278#discussion_r1156240099
More information about the core-libs-dev
mailing list