diff options
Diffstat (limited to 'tests/new/StaticInitName.java')
-rw-r--r-- | tests/new/StaticInitName.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/new/StaticInitName.java b/tests/new/StaticInitName.java new file mode 100644 index 000000000..657bd2ebb --- /dev/null +++ b/tests/new/StaticInitName.java @@ -0,0 +1,47 @@ + +import org.aspectj.testing.Tester; +import java.util.*; + +/** @testcase PR#771 static initializer member name */ +public class StaticInitName { + + public static void main(String[] args) { + Tester.expectEvent("C"); + Tester.event(""+C.class.getName()); + Tester.expectEvent("D"); + Tester.event(""+D.class.getName()); + Tester.checkAllEvents(); + } +} + +class C { + static int i = 1; +} + +class D { + static int i; + static { + i = 2; + } +} + +aspect A { + static { + Tester.expectEvent("before"); + Tester.expectEvent("before-D"); + } + + before() : within(C) && !set(* *) { + Tester.event("before"); + String memberName = thisJoinPoint.getSignature().getName(); + Tester.check("<clinit>".equals(memberName), + "\"<clinit>\".equals(\"" + memberName + "\")"); + } + + before() : within(D) && !set(* *) { + Tester.event("before-D"); + String memberName = thisJoinPoint.getSignature().getName(); + Tester.check("<clinit>".equals(memberName), + "\"<clinit>\".equals(\"" + memberName + "\")"); + } +} |