diff --git a/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java b/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java index 2939ea7c..f2c90030 100644 --- a/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java +++ b/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java @@ -260,12 +260,15 @@ public interface BeanContainer { *

* In line with the specification for beans and typesafe resolution, the set of * {@code beanTypes} is considered to always include {@code java.lang.Object}. + * Types in {@code beanTypes} that are not legal bean types are ignored. * The set of {@code beanQualifiers} is considered to always include {@code @Any} and * also include {@code @Default} when it contains no other qualifier but {@code @Any} * and {@code @Named}. The set of {@code requiredQualifiers} is considered to include * {@code @Default} when it is empty. *

- * Throws {@link IllegalArgumentException} if any of the arguments is {@code null}. + * Throws {@link IllegalArgumentException} if any of the arguments is {@code null} + * or if any of the {@code beanQualifiers} or {@code requiredQualifiers} is not + * a qualifier annotation. * * @param beanTypes bean types of a bean; must not be {@code null} * @param beanQualifiers qualifiers of a bean; must not be {@code null} @@ -278,21 +281,27 @@ boolean isMatchingBean(Set beanTypes, Set beanQualifiers, Type Set requiredQualifiers); /** - * Returns {@code true} if an event object with given type and qualifiers would match - * an observer method with given observed event type and observed event qualifiers, {@code false} otherwise. + * Returns {@code true} if an event with given specified type and specified qualifiers would + * match an observer method with given observed event type and observed event qualifiers, + * {@code false} otherwise. *

- * In line with the specification for events and observer resolution, the set of - * {@code eventQualifiers} is considered to always include {@code @Any}. + * In line with the specification for events and observer resolution, the event type used is + * the {@code specifiedType} and the set of event qualifiers used is a set that contains all + * {@code specifiedQualifiers} and {@code @Any}. Also, this method returns {@code true} when + * {@code observedEventQualifiers} contains {@code @Default} and the set of {@code specifiedQualifiers} + * is empty. *

- * Throws {@link IllegalArgumentException} if any of the arguments is {@code null}. + * Throws {@link IllegalArgumentException} if any of the arguments is {@code null}, + * if the {@code specifiedType} contains a type variable, or if any of the {@code specifiedQualifiers} + * or {@code observedEventQualifiers} is not a qualifier annotation. * - * @param eventType type of an event object; must not be {@code null} - * @param eventQualifiers event qualifiers; must not be {@code null} + * @param specifiedType specified type of an event; must not be {@code null} + * @param specifiedQualifiers specified qualifiers of an event; must not be {@code null} * @param observedEventType observed event type of an observer method; must not be {@code null} * @param observedEventQualifiers observed event qualifiers on an observer method; must not be {@code null} - * @return {@code true} if an event object with given type and qualifiers would result in notifying + * @return {@code true} if an event object with given runtime type and qualifiers would result in notifying * an observer method with given observed event type and observed event qualifiers, {@code false} otherwise */ - boolean isMatchingEvent(Type eventType, Set eventQualifiers, Type observedEventType, + boolean isMatchingEvent(Type specifiedType, Set specifiedQualifiers, Type observedEventType, Set observedEventQualifiers); }