Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Join point on main

Laurent,

It does work. The syntax you posted isn't valid AspectJ code, but if you were using a call pcd then it wouldn't execute unless you wove into the JDK that calls the main method. Here's an example of how to do it using execution:

aspect TraceMain {
    pointcut main() : execution(public static void PointcutMain.main(String[]));
    
    before() : main() {
	System.out.println("Entering main...");
    }
}

public class PointcutMain {
    public static void main(String args[]) {
    }
}


Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895

> ------------Original Message-------------
> From: "laurent.lemoux@xxxxxxxx" <laurent.lemoux@xxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Oct-1-2003 7:45 AM
> Subject: [aspectj-users] Join point on main
> 
> Hello,
> 
> I just started to use aspectJ in the Eclipse environment.
> I have no difficulty to define  a join point on a method call except when I try with the main method.
> 
> The following is not executed :
> 
> pointcut main() : public static void MyClass.main(String[]);
> 	
> before : main() {
>   System.out.println("Entering main...");
> }
> 
> Is it forbiden to set a pointcut on a static method ? If yes, why doesn't  the aspectJ compiler complain ?
> 
> Thanks in advance for the clarification,
> 
> Laurent
> 
> ------------------------------------------
> 
> Faites un voeu et puis Voila ! www.voila.fr 
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 


Back to the top