Skip to content

Commit

Permalink
Exclude Optionals from CDI Validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Jun 23, 2020
1 parent 92b5268 commit 2f8fb38
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void validate(@Observes AfterDeploymentValidation adv) {

// We don't validate the Optional / Provider / Supplier / ConfigValue for defaultValue.
if (type instanceof Class && ConfigValue.class.isAssignableFrom((Class<?>) type)
|| type instanceof Class && OptionalInt.class.isAssignableFrom((Class<?>) type)
|| type instanceof Class && OptionalLong.class.isAssignableFrom((Class<?>) type)
|| type instanceof Class && OptionalDouble.class.isAssignableFrom((Class<?>) type)
|| type instanceof ParameterizedType
&& (Optional.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType())
|| Provider.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType())
Expand Down

0 comments on commit 2f8fb38

Please sign in to comment.