Honors Adjunct Assignment 1: Due date: Feb. 3, 2003 Study aspectj.org. Install AspectJ following: http://www.ccs.neu.edu/home/lieber/com3360/w03/CCS_AspectJ_Usage.html Write an AspectJ program that prints a message to the output file whenever a method of some class C calls a method of class C. In other words, detect all local calls. Print the join point object for each such call on a separate line. This is part of a Law of Demeter Checker written in AspectJ. Reuse the following utility class. // author: Pengcheng Wu import org.aspectj.lang.reflect.*; import org.aspectj.lang.*; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.reflect.SourceLocation; import java.util.*; class JPUtil { static String toString(JoinPoint jp) { SourceLocation sl = jp.getSourceLocation(); String fname = sl.getFileName(); int line = sl.getLine(); int col = sl.getColumn(); Object [] argsArray = jp.getArgs(); System.out.println("arguments"); for(int i=0; i>> " + jp.getSignature().toString() + " in " + fname + " line " + line + "(" + col + ") "; // + " args " + argsArray; // + " toLongString " + jp.toLongString(); } } Use a pointcut like: call(* *(..)) && ... and advice statements like: Object thisObject = thisJoinPoint.getThis(); Object targetObject = thisJoinPoint.getTarget(); -- Karl Lieberherr