Skip to content

Commit

Permalink
Helidon Config CDI extension defensive code
Browse files Browse the repository at this point in the history
Injection points were being created regardless of whether the @ConfigProperty
annotation existed. This was causing CDI TCK issues where injection points
were not needed.

This change just checks for the right annotation before creating the injection
point.

Signed-off-by: Matthew Gill <matthew.gill@live.co.uk>
  • Loading branch information
MattGill98 committed Jun 17, 2022
1 parent 480e77d commit 47e5874
Showing 1 changed file with 6 additions and 10 deletions.
Expand Up @@ -142,19 +142,15 @@ private <X> void harvestConfigPropertyInjectionPointsFromEnabledObserverMethod(@

AnnotatedMethod<X> annotatedMethod = event.getAnnotatedMethod();
List<AnnotatedParameter<X>> annotatedParameters = annotatedMethod.getParameters();

if (annotatedParameters != null) {
for (AnnotatedParameter<?> annotatedParameter : annotatedParameters) {
if ((annotatedParameter != null)
&& !annotatedParameter.isAnnotationPresent(Observes.class)) {
InjectionPoint injectionPoint = beanManager.createInjectionPoint(annotatedParameter);
Set<Annotation> qualifiers = injectionPoint.getQualifiers();
assert qualifiers != null;
for (Annotation qualifier : qualifiers) {
if (qualifier instanceof ConfigProperty) {
ips.add(injectionPoint);
break;
}
}
&& !annotatedParameter.isAnnotationPresent(Observes.class)
&& annotatedParameter.isAnnotationPresent(ConfigProperty.class)) {

final var injectionPoint = beanManager.createInjectionPoint(annotatedParameter);
ips.add(injectionPoint);
}
}
}
Expand Down

0 comments on commit 47e5874

Please sign in to comment.