Skip to content

Commit

Permalink
Avoid getMostSpecificMethod resolution for non-annotated methods
Browse files Browse the repository at this point in the history
This is aligned with AutowiredAnnotationBeanPostProcessor now.

Closes gh-31967
  • Loading branch information
jhoeller committed Jan 7, 2024
1 parent 419e34e commit 9912a52
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -456,8 +456,8 @@ else if (javaxResourceType != null && field.isAnnotationPresent(javaxResourceTyp
if (!BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod)) {
return;
}
if (method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (ejbAnnotationType != null && bridgedMethod.isAnnotationPresent(ejbAnnotationType)) {
if (ejbAnnotationType != null && bridgedMethod.isAnnotationPresent(ejbAnnotationType)) {
if (method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("@EJB annotation is not supported on static methods");
}
Expand All @@ -467,7 +467,9 @@ else if (javaxResourceType != null && field.isAnnotationPresent(javaxResourceTyp
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz);
currElements.add(new EjbRefElement(method, bridgedMethod, pd));
}
else if (jakartaResourceType != null && bridgedMethod.isAnnotationPresent(jakartaResourceType)) {
}
else if (jakartaResourceType != null && bridgedMethod.isAnnotationPresent(jakartaResourceType)) {
if (method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("@Resource annotation is not supported on static methods");
}
Expand All @@ -480,7 +482,9 @@ else if (jakartaResourceType != null && bridgedMethod.isAnnotationPresent(jakart
currElements.add(new ResourceElement(method, bridgedMethod, pd));
}
}
else if (javaxResourceType != null && bridgedMethod.isAnnotationPresent(javaxResourceType)) {
}
else if (javaxResourceType != null && bridgedMethod.isAnnotationPresent(javaxResourceType)) {
if (method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("@Resource annotation is not supported on static methods");
}
Expand Down

0 comments on commit 9912a52

Please sign in to comment.