Skip to content

Commit 9b60c6c

Browse files
committed
[refactor] Make it clear that adding to an EmptyNodeSet is not possible
1 parent 73e2473 commit 9b60c6c

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

exist-core/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@
918918
<include>src/main/java/org/exist/dom/persistent/DocumentSet.java</include>
919919
<include>src/main/java/org/exist/dom/persistent/DocumentTypeImpl.java</include>
920920
<include>src/main/java/org/exist/dom/persistent/ElementImpl.java</include>
921+
<include>src/main/java/org/exist/dom/persistent/EmptyNodeSet.java</include>
921922
<include>src/main/java/org/exist/dom/persistent/LockToken.java</include>
922923
<include>src/main/java/org/exist/dom/persistent/NewArrayNodeSet.java</include>
923924
<include>src/main/java/org/exist/dom/persistent/NodeProxy.java</include>
@@ -1626,6 +1627,7 @@
16261627
<exclude>src/main/java/org/exist/dom/persistent/DocumentSet.java</exclude>
16271628
<exclude>src/main/java/org/exist/dom/persistent/DocumentTypeImpl.java</exclude>
16281629
<exclude>src/main/java/org/exist/dom/persistent/ElementImpl.java</exclude>
1630+
<exclude>src/main/java/org/exist/dom/persistent/EmptyNodeSet.java</exclude>
16291631
<exclude>src/main/java/org/exist/dom/persistent/LockToken.java</exclude>
16301632
<exclude>src/main/java/org/exist/dom/persistent/NewArrayNodeSet.java</exclude>
16311633
<exclude>src/main/java/org/exist/dom/persistent/NodeProxy.java</exclude>

exist-core/src/main/java/org/exist/dom/persistent/EmptyNodeSet.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
* admin@evolvedbinary.com
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -67,10 +91,12 @@ public boolean hasOne() {
6791

6892
@Override
6993
public void add(final NodeProxy proxy) {
94+
throw new IllegalStateException("Cannot add a NodeProxy to an EmptyNodeSet because it is immutable");
7095
}
7196

7297
@Override
7398
public void addAll(final NodeSet other) {
99+
throw new IllegalStateException("Cannot add a NodeSet to an EmptyNodeSet because it is immutable");
74100
}
75101

76102
@Override

0 commit comments

Comments
 (0)