For your example, you actually want the around advice to return something -- your Calc instance. The reason around advice requires a return type is that you can place around advice around any method without the client necessarily knowing that around advice is being executed. If the client expects a return value, then give them one, either via capturing the return value from proceed(), the advice's own return value. If it makes sense to return go ahead, and if the advised method returns void, just return null from your around advice.
HTH, Matthew On Wed, Jun 30, 2010 at 2:23 AM, Pawel Branc <[email protected]> wrote: > Hello, > I learn aspectJ, being at the beginning. > > I have 2 classes. I want to send second class to another computer and > take its object remotely. > > //class which will be used locally > public class CalcExecutor > { > public static void main(String[] args) > { > long num1 = Integer.parseInt(args[0]); > long num2 = Integer.parseInt(args[1]); > Calc c = new Calc(); > System.out.println( "We add: "+num1 +" and: "+ num2 +"and > obtain: > "+c.add(num1, num2) ); > } > } > > //class which I want to send and use its object remotely > public class Calc > { > public Calc() {} > > public long add(long a, long b) > { > return a + b; > } > } > > I would like to shadow with around() advice: > THIS > Calc c = new Calc(); > WITH THIS > Calc c = (Calc)Naming.lookup("rmi://localhost:1099/CalculatorService"); > > I have problem with around() because it must return something. But why? > Could You help me. Thanks a lot. > Pawel > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > -- mailto:[email protected] skype:matthewadams12 yahoo:matthewadams aol:matthewadams12 google-talk:[email protected] msn:[email protected] http://matthewadams.me http://www.linkedin.com/in/matthewadams _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
