RFR: 8320400: Make fields final in 'jdk.internal.util.xml.impl' package

Per Minborg pminborg at openjdk.org
Mon Nov 20 13:51:36 UTC 2023


On Tue, 12 Sep 2023 19:59:57 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> A few classes in `jdk.internal.util.xml.impl` package have non-final fields which could easily be marked `final`.
> 
> Also fixed a few typos and incorrect javadoc links.

src/java.base/share/classes/jdk/internal/util/xml/impl/XMLStreamWriterImpl.java line 78:

> 76:     private boolean _doIndent = true;
> 77:     //The system line separator for writing out line breaks.
> 78:     private final char[] _lineSep = System.lineSeparator().toCharArray();

The method System.lineSeparator() is specified such that it will always return the same value. Hene, I proposes:


    @Stable
    private static final char[] LINE_SEP = System.lineSeparator().toCharArray();

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15691#discussion_r1399231282


More information about the core-libs-dev mailing list