Skip to content

Conversation

@dwalluck
Copy link
Contributor

@dwalluck dwalluck commented Apr 2, 2025

This fixes the warning "Assigning a collection of nullable elements into a collection of non-null elements" which was a difference between what PurlParameters::getQualifiers returns and what PackageURL::new expects. So far, we don't have an example of qualifiers with null elements, but we can just return "null" instead which should have the same effect when comparing values.

Simplify the creation of the qualifiers map from the JSONObject by using Collectors::toMap.

This fixes the warning "Assigning a collection of nullable elements
into a collection of non-null elements" which was a difference between
what `PurlParameters::getQualifiers` returns and what `PackageURL::new`
expects. So far, we don't have an example of qualifiers with `null`
elements, but we can just return `"null"` instead which should have the
same effect when comparing values.

Simplify the creation of the qualifiers map from the `JSONObject` by
using `Collectors::toMap`.
@ppkarwasz
Copy link
Contributor

I think there are test cases, where the value assigned to a key is null. This change transforms that value to the string "null".

In test cases, nullability warnings are bound to happen: we want to test what happens if the consumer does not check the JSpecify annotations and passes a qualifiers map that has null as key or value.

If the value is null, IMHO the implementation should drop the entry.

@dwalluck
Copy link
Contributor Author

dwalluck commented Apr 3, 2025

No problem, null is back in ebeeb33.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants