5656 * All the methods in this class are safe to use by multiple concurrent threads.
5757 * </p>
5858 *
59- * @version 2.0 , November 4 , 2020
59+ * @version 2.1 , November 16 , 2020
6060 * @author Werner Keil
6161 * @author Martin Desruisseaux
6262 * @since 1.0
@@ -221,7 +221,12 @@ private static final class Selector implements Predicate<ServiceProvider>, Compa
221221 public boolean test (ServiceProvider provider ) {
222222 Object value = null ;
223223 if (nameGetter != null ) {
224- Annotation a = provider .getClass ().getAnnotation (namedAnnotation );
224+ Annotation a = null ;
225+ if (namedAnnotation != null ) {
226+ a = provider .getClass ().getAnnotation (namedAnnotation );
227+ } else if (jakartaNamedAnnotation != null ) {
228+ a = provider .getClass ().getAnnotation (jakartaNamedAnnotation );
229+ }
225230 if (a != null ) try {
226231 value = nameGetter .invoke (a , (Object []) null );
227232 } catch (IllegalAccessException | InvocationTargetException e ) {
@@ -242,7 +247,12 @@ public boolean test(ServiceProvider provider) {
242247 */
243248 private int priority (ServiceProvider provider ) {
244249 if (priorityGetter != null ) {
245- Annotation a = provider .getClass ().getAnnotation (priorityAnnotation );
250+ Annotation a = null ;
251+ if (priorityAnnotation != null ) {
252+ a = provider .getClass ().getAnnotation (priorityAnnotation );
253+ } else if (jakartaPriorityAnnotation != null ) {
254+ a = provider .getClass ().getAnnotation (jakartaPriorityAnnotation );
255+ }
246256 if (a != null ) try {
247257 return (Integer ) priorityGetter .invoke (a , (Object []) null );
248258 } catch (IllegalAccessException | InvocationTargetException e ) {
0 commit comments