[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] [NEWBIE] Return type for the method is missing

Please address this sort of question to the aspectj-users list.

Cheers,
Nick
--- Sri Sankaran <Sri.Sankaran@xxxxxxx> wrote:
> Using: AspectJ v1.1.1 (as reported by ajc -version)
>  
> OK, so I am just starting out with AOP and AspectJ.
> 
> I have a simple ol' Java class:
>  
> public class MainClass {
>   public void wasteTime(int duration) {
>     try {
>       Thread.sleep(duration*1000);
>     } catch (InterruptedException e) {
>       System.out.println("Sleep interrupted");
>     }
>   }
> }
>  
> I then wrote an aspect with a a couple of pointcuts and a few advices. 
> Upon compilation these generate all kinds of errors. I have whittled it
> down to one pointcut and one advice.
> 
> public aspect Timer {
> 
>   pointcut logEntry() : call(* MainClass.wasteTime(..));
> 
>   after : logEntry() {
>     System.out.println("foo");
>   }
> }
> 
> This generates 3 errors:
> Timer.java:18 Return type for the method is missing
> pointcut logEntry() : call(* MainClass.wasteTime(..));
>                       ^^^^
> 
> Timer.java:21 Syntax error on token ":", "(" expected
> after : logEntry() {
>       ^
> 
> Timer.java:21 Return type for the method is missing
> after : logEntry() {
>         ^^^^^^^^^^
> 
> Can you help?
> 
> Sri 
> jÊ^rØÝzù??X§?X¬µ«)yËcuëÞrX©±ê+?m§ÿÝz÷??*lz?àþf¢?f§þX¬¶)ߣö¬¥ç-?ׯ