From afa6f17225ad60dbd929621c1ff91bb9dfad53a9 Mon Sep 17 00:00:00 2001 From: Andrei Solntsev Date: Thu, 31 Oct 2024 00:37:48 +0200 Subject: [PATCH] #429 [refactor] make class `DocumentSplitter.NamespaceScope` immutable --- .../main/java/org/xhtmlrenderer/pdf/DocumentSplitter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flying-saucer-pdf/src/main/java/org/xhtmlrenderer/pdf/DocumentSplitter.java b/flying-saucer-pdf/src/main/java/org/xhtmlrenderer/pdf/DocumentSplitter.java index 0aa88fb25..95fdde728 100644 --- a/flying-saucer-pdf/src/main/java/org/xhtmlrenderer/pdf/DocumentSplitter.java +++ b/flying-saucer-pdf/src/main/java/org/xhtmlrenderer/pdf/DocumentSplitter.java @@ -19,6 +19,7 @@ */ package org.xhtmlrenderer.pdf; +import org.jspecify.annotations.Nullable; import org.w3c.dom.Document; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -244,10 +245,12 @@ public String getUri() { } private static final class NamespaceScope { - private NamespaceScope _parent; + @Nullable + private final NamespaceScope _parent; private final List _namespaces = new LinkedList<>(); private NamespaceScope() { + _parent = null; } private NamespaceScope(NamespaceScope parent) { @@ -280,6 +283,7 @@ private void replay(ContentHandler contentHandler, Set seen, boolean sta } } + @Nullable public NamespaceScope getParent() { return _parent; }