

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda, C. Lopes, J. Loingtier, J. Irwin CSci 780 Advanced Software Engineering 2
7
$ javac TestClass.java $ java TestClass Hello! ok. $ 11 public aspect MyAspect { public pointcut sayMethodCall (): call (public void TestClass.say*() ); public (public void pointcut sayMethodCallArg TestClass.sayAnyThing (String (String)) str): call && args(str); before(): sayMethodCall() { System.out. thisJoinPointStaticPart.println("\n TestClassgetSignature." +().getName() + “ start..." ); } after(): sayMethodCall() { thisJoinPointStaticPart.^ System.out.println("\ngetSignature^ TestClass().." +getName() + “ end..."); } before(String str): sayMethodCallArg(str) { if (str.length() < 3) { System.out. words less than 3 characters");println ("Error: I can't say return; } } } (^12) public class TestClass { public void sayHello () { System.out.println ("Hello!"); } public void sayAnyThing (String s) { System.out.println (s); } public static void main (String[] args) { sayHello (); sayAnyThing ("ok."); } }