You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When populating an object from a different source, its convenient to use the static factory methods like Code.of() like the following
Describe the solution you'd like Code.of(null) and similar convience functions should return null if null is passed in. Instead of trying to create a privitive FHIR object with no value which is guaranteed to fail with ele-1.
Describe alternatives you've considered
Add javadoc to explain it will throw if you pass a null.
The text was updated successfully, but these errors were encountered:
I have validated the javadoc and the addition of Object.requireNotNull() method calls via visual inspection of classes in the fhir-model project and have validated that when attempting to pass a null value to these factory methods a NullPointerException is thrown indicating the name of the argument containing the null value.
lmsurpre
changed the title
FHIR primitive static factory helpers should be more resilient to nulls
FHIR primitive static factory helpers should throw appropriate exceptions when null is passed
May 17, 2021
Is your feature request related to a problem? Please describe.
When populating an object from a different source, its convenient to use the static factory methods like Code.of() like the following
However, if that source data can contain nulls, then today this breaks on the
Code.of(null)
with the following:This despite the following code working with no issue:
Describe the solution you'd like
Code.of(null)
and similar convience functions should return null if null is passed in. Instead of trying to create a privitive FHIR object with no value which is guaranteed to fail withele-1
.Describe alternatives you've considered
Add javadoc to explain it will throw if you pass a null.
The text was updated successfully, but these errors were encountered: