From 6cceb1b9c3b53e92166d61435f28318e2b9a8872 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 28 Jan 2004 00:36:05 +0000 Subject: fix for Bugzilla Bug 49295 duplicate warning or second join point for constructor-execution --- tests/bugs/InterfaceInitializerOrder.java | 26 ++++++++++++++++++++++++++ tests/bugs/SubtypeConstructorCW.java | 4 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/InterfaceInitializerOrder.java (limited to 'tests/bugs') diff --git a/tests/bugs/InterfaceInitializerOrder.java b/tests/bugs/InterfaceInitializerOrder.java new file mode 100644 index 000000000..3036bcac9 --- /dev/null +++ b/tests/bugs/InterfaceInitializerOrder.java @@ -0,0 +1,26 @@ +import org.aspectj.testing.Tester; + +public class InterfaceInitializerOrder { + public static void main(String[] args) { + Base base = new Base(); + Tester.checkEqual(InitAspect.inits.toString(), "Super1,Super2,SuperInterface,Base,"); + } +} + +class Super1 {} + +class Super2 extends Super1 {} + +interface SuperInterface {} + +class Base extends Super2 implements SuperInterface { } + +aspect InitAspect { + public static StringBuffer inits = new StringBuffer(); + + pointcut outerMatch() : initialization(new(..)) && !within(InitAspect); + before() : outerMatch() { + inits.append(thisJoinPoint.getSignature().getDeclaringType().getName()); + inits.append(","); + } +} diff --git a/tests/bugs/SubtypeConstructorCW.java b/tests/bugs/SubtypeConstructorCW.java index d3b6a8765..f37ac8b37 100644 --- a/tests/bugs/SubtypeConstructorCW.java +++ b/tests/bugs/SubtypeConstructorCW.java @@ -7,8 +7,8 @@ class C implements Runnable { // CW 5 } } class F implements Runnable { - F(int i) {// CW 10 - } + F(int i) {}// CW 10 + public void run() { } } -- cgit v1.2.3