--- /dev/null
+
+public aspect RunInjarMains {
+ before() : execution(static void packageOne.main(String[])) {
+ String[] args = new String[0];
+ InjarOneMain.main(args);
+ InjarTwoMain.main(args);
+ }
+}
\ No newline at end of file
--- /dev/null
+
+import org.aspectj.testing.Tester;
+import org.aspectj.lang.JoinPoint;
+
+public aspect TraceMains {
+ private static String className(JoinPoint.StaticPart jp) {
+ return jp.getSignature().getDeclaringType().getName();
+ }
+ before() : execution(static void main(String[])) {
+ Tester.event("before main " + className(thisJoinPointStaticPart));
+ }
+ after() returning: execution(static void main(String[])) {
+ Tester.event("after main " + className(thisJoinPointStaticPart));
+ }
+
+}
\ No newline at end of file
--- /dev/null
+
+package packageOne;
+
+import org.aspectj.testing.Tester;
+
+public class Main {
+ public static void main(String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ Tester.expectEvent(args[i]);
+ }
+ Tester.event("in longer packageOne.Main.main(..)");
+ Tester.checkAllEvents();
+ }
+}
+
+
--- /dev/null
+
+package packageOne;
+
+import org.aspectj.testing.Tester;
+
+public class Main {
+ public static void main(String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ Tester.expectEvent(args[i]);
+ }
+ Tester.event("in packageOne.Main.main(..)");
+ Tester.checkAllEvents();
+ }
+}
+