eclipse-aspectj / aspectj

Other
303 stars 86 forks source link

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

Closed sbrannen closed 1 year ago

sbrannen commented 1 year ago

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](https://ge.spring.io/s/v2js2afkh3zom/tests/task/:spring-aop:test/details/org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactoryTests/namedPointcutFromAspectLibrary()?top-execution=1).

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 https://github.com/spring-projects/spring-framework/commit/c72dd1ff66f841443e864925061d0ff01a1a59be.

kriegaex commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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.