Skip to content
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

6.1.3 regression: aspect not called with multiple inheritance #32181

Closed
Piloon opened this issue Feb 1, 2024 · 6 comments
Closed

6.1.3 regression: aspect not called with multiple inheritance #32181

Piloon opened this issue Feb 1, 2024 · 6 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: feedback-provided Feedback has been provided type: regression A bug that is also a regression
Milestone

Comments

@Piloon
Copy link

Piloon commented Feb 1, 2024

We discovered a regression when upgrading from Spring Boot 3.2.1 to Spring Boot 3.2.2.

We have classes with 3 levels of inheritances:

class A {
   String myMethod() { do_stuff; }
} 
class B extends A {
   @Override
   String myMethod()  { 
    super.myMethod();
     do_more_stuff;
   }
} 
@Component
class C extends B {
   // does not override myMethod()
} 

We have a pointcut for the method myMethod

When we inject an object A (an instance of C in our case) and we call the method myMethod, the aspect is not called.
If we override in C myMethod by calling super.myMethod, it works. If it is B that is annotated @component, it works.

The following project reproduces the problem:

demo.zip

When called with Boot 3.2.1, the result is :

===== Aspect called ====

test A: 123
test B: 123

When called with Boot 3.2.2, the result is:

test A: 123
test B: 123
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 1, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Feb 1, 2024

This could be related to #32087. Could you please give a 6.1.4 snapshot a try to see whether the issue is still present there?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Feb 1, 2024
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label Feb 1, 2024
@Piloon
Copy link
Author

Piloon commented Feb 1, 2024

Yes I tried and the problem is still present

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 1, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Feb 1, 2024

Thanks for the quick check! I suspect that this is a side effect from #21843 in some other form then; we'll revisit this for 6.1.4.

@jhoeller jhoeller added type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 1, 2024
@jhoeller jhoeller added this to the 6.1.4 milestone Feb 1, 2024
@jhoeller jhoeller self-assigned this Feb 1, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Feb 1, 2024

This turned out to be a generics matching problem: As your attached demo illustrates, the step-by-step narrowing of the generic type at multiple hierarchy levels - without a concrete declaration at the lowest level - broke the bridge method resolution.

We selectively use the concrete target class for candidate retrieval now (which is necessary for the Eclipse compiler compatibility that the 6.1.3 change brought) whereas for method matching we use the declaration level (as before 6.1.3). This hopefully addresses all scenarios now.

@Piloon please give the upcoming 6.1.4 snapshot (https://ci.spring.io/teams/spring-framework/pipelines/spring-framework-6.1.x/jobs/build/builds/1382) another try, I hope this fixes your actual scenario as well.

@Piloon
Copy link
Author

Piloon commented Feb 2, 2024

@jhoeller , the new 6.1.4 snapshot fixes the issue. Thanks a lot for the quick fix !

@jhoeller
Copy link
Contributor

jhoeller commented Feb 2, 2024

Good to hear, thanks for double-checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: feedback-provided Feedback has been provided type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

4 participants