New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@annotation pointcut is not matched with complex hierarchy and generics [SPR-17310] #21843
Comments
Yanming Zhou commented It seems eclipse compiler bug. I'm not sure it has relation with https://bugs.eclipse.org/bugs/show_bug.cgi?id=495396 |
Yanming Zhou commented I have reported https://bugs.eclipse.org/bugs/show_bug.cgi?id=539651 |
Yanming Zhou commented Finally I figure it out, method.getDeclaringClass() return wrong class with eclipse compiler, it cause spring ClassUtils.getMostSpecificMethod() return wrong method. @Test
public void test() throws Exception {
Class<?> targetClass = UserManagerImpl.class;
Method method = targetClass.getMethod("save", Persistable.class);
assertEquals(targetClass, method.getDeclaringClass()); // eclipse compiler fail
} |
Yanming Zhou commented javac create two bridge methods: public void com.example.UserManagerImpl.save(com.example.Persistable)
public void com.example.UserManagerImpl.save(com.example.BaseUser) ecj create only one bridge method: public void com.example.UserManagerImpl.save(com.example.BaseUser) It seems a corner case that JLS not covered, maybe it's not a bug of eclipse compiler, Juergen Hoeller could you make some changes to keep compatibility with both of them? |
Yanming Zhou commented Workaround: add two lines before return statement resolvedMethod = BridgeMethodResolver.findBridgedMethod(resolvedMethod);
resolvedMethod = ClassUtils.getMostSpecificMethod(resolvedMethod, specificTargetClass); |
Minimized unit test, It will fail in eclipse.
|
Yanming Zhou opened SPR-17310 and commented
The mostSpecificMethod should return method UserManagerImpl.save(User), but return BaseUserManagerImpl.save(BaseUser) which doesn't annotated, it will cause
@annotation
pointcut broken.Affects: 5.1 GA
Attachments:
The text was updated successfully, but these errors were encountered: