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

Regression: execution(!void get*()) no longer works in AspectJ 1.9.20 #257

Closed
sbrannen opened this issue Aug 22, 2023 · 3 comments · Fixed by #258
Closed

Regression: execution(!void get*()) no longer works in AspectJ 1.9.20 #257

sbrannen opened this issue Aug 22, 2023 · 3 comments · Fixed by #258
Assignees
Labels
bug Something isn't working
Milestone

Comments

@sbrannen
Copy link

sbrannen commented Aug 22, 2023

In the test suite for the Spring Framework, we have had the following pointcut for several years.

@Pointcut("execution(!void get*())")
void propertyAccess() {}

However, once we upgraded from AspectJ 1.9.19 to 1.9.20, our test using that pointcut began to fail.

Specifically, the above pointcut no longer matches a method such as int getAge();.

To get our test to pass again, we changed the pointcut to @Pointcut("execution(int get*())") in spring-projects/spring-framework@c72dd1f.

@kriegaex
Copy link
Contributor

Thank you, @sbrannen. This is indeed a regression, and it affects all negated type patterns, not just !void, i.e. also something like !String (which then in turn should match void types, among many others). I have created a regression test already. When I can fix that depends on my free cycles outside of work.

@kriegaex kriegaex added this to the 1.9.20.1 milestone Aug 23, 2023
@kriegaex kriegaex self-assigned this Aug 23, 2023
@kriegaex kriegaex added the bug Something isn't working label Aug 23, 2023
kriegaex added a commit that referenced this issue Aug 23, 2023
Relates to #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
Relates to #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
The implementation for boolean matchesArray(UnresolvedType type) was
buggy.

'!String' should match anything but String, no matter if it is
an array or not, e.g. int, void, int[], String[].

'!String[]' should match anything but String[], no matter if it is
an array or not, e.g. int, void, int[], String.

Fixes #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
Relates to #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
The implementation for boolean matchesArray(UnresolvedType type) was
buggy.

'!String' should match anything but String, no matter if it is
an array or not, e.g. int, void, int[], String[], String[][].

'!String[]' should match anything but String[], no matter if it is
an array or not, e.g. int, void, int[], String, String[][].

Fixes #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
Relates to #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
The implementation for boolean matchesArray(UnresolvedType type) was
buggy.

'!String' should match anything but String, no matter if it is
an array or not, e.g. int, void, int[], String[], String[][].

'!String[]' should match anything but String[], no matter if it is
an array or not, e.g. int, void, int[], String, String[][].

Fixes #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
A change made to ajc162.xml in commit 43cb1e2 has been reverted
and improved after the recent negated type pattern fix. Relates to #257.

The pointcut 'call(!void *.*(..)) && this(src) && target(dst)' actually
does match method call 'payloadClass.getPayload()' within the
around-advice in GenericClassInAdvice itself.

Improvement: Activate '-showWeaveInfo' and verify weaving message.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
Relates to #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
The implementation for boolean matchesArray(UnresolvedType type) was
buggy.

'!String' should match anything but String, no matter if it is
an array or not, e.g. int, void, int[], String[], String[][].

'!String[]' should match anything but String[], no matter if it is
an array or not, e.g. int, void, int[], String, String[][].

Fixes #257.

Signed-off-by: Alexander Kriegisch <[email protected]>
kriegaex added a commit that referenced this issue Aug 23, 2023
A change made to ajc162.xml in commit 43cb1e2 has been reverted
and improved after the recent negated type pattern fix. Relates to #257.

The pointcut 'call(!void *.*(..)) && this(src) && target(dst)' actually
does match method call 'payloadClass.getPayload()' within the
around-advice in GenericClassInAdvice itself.

Improvement: Activate '-showWeaveInfo' and verify weaving message.

Signed-off-by: Alexander Kriegisch <[email protected]>
@kriegaex
Copy link
Contributor

kriegaex commented Aug 23, 2023

@sbrannen, the problem should be fixed. Please try the latest 1.9.21-SNAPSHOT in your Spring build. Without feedback, I am not confident to release 1.9.20.1 anytime soon.

<repositories>
    <repository>
        <id>ossrh-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

@kriegaex
Copy link
Contributor

kriegaex commented Sep 4, 2023

I am disappointed that there was no re-testing feedback. That lack of feedback kept me withholding the AspectJ 1.9.20.1 bugfix release for longer than necessary. Anyway, today I released the new version. Enjoy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants