You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/03/20 13:19:26 UTC

(commons-jxpath) 02/08: Make the private DOMNodePointer.id field final

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git

commit 02cd5795ad553435bf34e18bc67acde7932ce439
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Thu Mar 20 08:32:55 2025 -0400

    Make the private DOMNodePointer.id field final
---
 src/changes/changes.xml                                             | 1 +
 .../java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4934dea..9ac5c3f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -128,6 +128,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate Constants.Constants().</action>
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate Parser.Parser().</action>
       <action dev="ggregory" type="fix" due-to="Gary Gregory">JXPathException.JXPathException(Throwable) now remembers its Throwable cause argument.</action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">Make the private DOMNodePointer.id field final.</action>
       <!-- ADD -->
       <action issue="JXPATH-123" dev="mbenson" type="add">
         XPath function "ends-with" is not implemented (although "starts-with" is).
diff --git a/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java b/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
index 2384f33..b3b1e6b 100644
--- a/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
+++ b/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
@@ -225,7 +225,7 @@ public class DOMNodePointer extends NodePointer {
     /**
      * Optional ID.
      */
-    private String id;
+    private final String id;
 
     /**
      * Supports {@link #getNamespaceResolver()}.
@@ -239,8 +239,7 @@ public class DOMNodePointer extends NodePointer {
      * @param locale Locale.
      */
     public DOMNodePointer(final Node node, final Locale locale) {
-        super(null, locale);
-        this.node = node;
+        this(node, locale, null);
     }
 
     /**
@@ -265,6 +264,7 @@ public class DOMNodePointer extends NodePointer {
     public DOMNodePointer(final NodePointer parent, final Node node) {
         super(parent);
         this.node = node;
+        this.id = null;
     }
 
     @Override