Skip to content

Commit b8a6273

Browse files
committed
getChildren of OffsetNode now returns unmodifiable list
1 parent f150740 commit b8a6273

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/ch/usi/si/seart/treesitter/OffsetTreeCursor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.experimental.FieldDefaults;
66
import org.jetbrains.annotations.NotNull;
77

8+
import java.util.Collections;
89
import java.util.List;
910
import java.util.Objects;
1011
import java.util.function.Consumer;
@@ -125,7 +126,10 @@ public int getChildCount() {
125126
public List<Node> getChildren() {
126127
return node.getChildren().stream()
127128
.map(OffsetNode::new)
128-
.collect(Collectors.toList());
129+
.collect(Collectors.collectingAndThen(
130+
Collectors.toList(),
131+
Collections::unmodifiableList
132+
));
129133
}
130134

131135
@Override

0 commit comments

Comments
 (0)