Skip to content

Commit

Permalink
refactor(spdx-utils): Make SpdxCompoundExpression take a Collection
Browse files Browse the repository at this point in the history
Make use of the fact that AND / OR operators are associative.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Feb 27, 2024
1 parent 1d86e6f commit 52ee940
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model/src/main/kotlin/utils/FindingsMatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,6 @@ internal fun associateLicensesWithExceptions(license: SpdxExpression): SpdxExpre
return if (associatedLicenses.size == 1) {
associatedLicenses.first()
} else {
SpdxCompoundExpression(SpdxOperator.AND, associatedLicenses.toList())
SpdxCompoundExpression(SpdxOperator.AND, associatedLicenses)
}
}
2 changes: 1 addition & 1 deletion utils/spdx/src/main/kotlin/SpdxExpression.kt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ sealed class SpdxExpression {
*/
class SpdxCompoundExpression(
val operator: SpdxOperator,
val children: List<SpdxExpression>
val children: Collection<SpdxExpression>
) : SpdxExpression() {
/**
* Create a compound expression with the provided [operator] and the [left] and [right] child expressions.
Expand Down

0 comments on commit 52ee940

Please sign in to comment.