You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by ta...@apache.org on 2026/07/24 23:32:26 UTC
(bval) 08/09: Cascade beans via child(PathImpl::addBean, ...) (one copy) and key the constraint-dedup map on pathReference() (no copy)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bval.git
commit d182f8f7609ca7d5ec6fa99ce8d9b840f604f187
Author: tandraschko <ta...@apache.org>
AuthorDate: Sat Jul 25 01:02:37 2026 +0200
Cascade beans via child(PathImpl::addBean, ...) (one copy) and key the constraint-dedup map on pathReference() (no copy)
---
bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java b/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
index 12747bb..4da1f30 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
@@ -144,8 +144,10 @@ public abstract class ValidationJob<T> {
// Use the same path ordering/equality as before (ConcurrentSkipListMap): comparator-based, not Path#equals.
final Map<Path, Set<Object>> pathMap = completedValidations.computeIfAbsent(constraint,
k -> new TreeMap<>(PathImpl.PATH_COMPARATOR));
+ // Read-only use as a comparator-based map key for the duration of this validation; no copy needed.
final Set<Object> objectSet =
- pathMap.computeIfAbsent(context.getPath(), p -> Collections.newSetFromMap(new IdentityHashMap<>()));
+ pathMap.computeIfAbsent(context.pathReference(),
+ p -> Collections.newSetFromMap(new IdentityHashMap<>()));
if (!objectSet.add(context.getValue())) {
return true;
}
@@ -249,7 +251,7 @@ public abstract class ValidationJob<T> {
BeanFrame(Frame<?> parent, GraphContext context) {
super(parent, getBeanDescriptor(context.getValue()),
- context.child(context.getPath().addBean(), context.getValue()));
+ context.child(PathImpl::addBean, context.getValue()));
this.realContext = context;
}