From e2a355b37935faf9a8de1ce7ca1f134b5a9df891 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Mon, 21 Aug 2023 17:18:27 +0700 Subject: Regression test for Spring issue 27761 Relates to spring-projects/spring-framework#27761. The test needs an ASM-generated class file with reordered methods in order to reproduce the issue in plain AspectJ. The test fails now, but should pass after the fix. Signed-off-by: Alexander Kriegisch --- .../java/org/aspectj/systemtest/ajc1920/Bugs1920Tests.java | 12 ++++++++++++ .../resources/org/aspectj/systemtest/ajc1920/ajc1920.xml | 11 +++++++++++ 2 files changed, 23 insertions(+) (limited to 'tests/src') diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Bugs1920Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Bugs1920Tests.java index 574f1b7aa..e1f3fa1ca 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/Bugs1920Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/Bugs1920Tests.java @@ -67,6 +67,18 @@ public class Bugs1920Tests extends XMLBasedAjcTestCase { runTest("correctly handle overloaded private methods in aspects"); } + /** + * If one generic method overrides another one with a narrower return type, avoid matching bridge methods. + *

+ * See Spring GitHub issue 27761. + *

+ * This test uses an ASM-modified class file reproducing the problem seen in Spring in plain AspectJ. Before the + * bugfix, it fails with "advice defined in RepositoryAspect has not been applied [Xlint:adviceDidNotMatch]". + */ + public void test_Spring_GitHub_27761() { + runTest("do not match bridge methods"); + } + public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Bugs1920Tests.class); } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml index 402f50a2f..db47e073d 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml @@ -418,4 +418,15 @@ + + + + + + + + + + + -- cgit v1.2.3