This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git
The following commit(s) were added to refs/heads/main by this push:
new 54bd034 sort nested components when they are used instead of before
they are resolved
54bd034 is described below
commit 54bd0349c0128d74a13967ef64b34e5a8ef4bd91
Author: Stefan Bodewig <[email protected]>
AuthorDate: Tue Jul 21 08:05:34 2026 +0200
sort nested components when they are used instead of before they are
resolved
---
src/main/org/apache/ant/cyclonedx/Component.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/org/apache/ant/cyclonedx/Component.java
b/src/main/org/apache/ant/cyclonedx/Component.java
index d7c783c..3b208fe 100644
--- a/src/main/org/apache/ant/cyclonedx/Component.java
+++ b/src/main/org/apache/ant/cyclonedx/Component.java
@@ -552,7 +552,6 @@ public class Component extends DataType {
.stream()
.flatMap(c -> c.getNestedComponents().stream())
.collect(Collectors.toList()));
- result.sort(ComponentComparator);
return result;
}
@@ -742,7 +741,9 @@ public class Component extends DataType {
.collect(Collectors.toList()));
component.setLicenses(lc);
}
- for (Component c : nestedComponents) {
+ for (Component c : nestedComponents.stream()
+ .sorted(ComponentComparator)
+ .collect(Collectors.toList())) {
component.addComponent(c.toAdditionalCycloneDxComponent(bomVersion));
}
addHashes(component, bomVersion);