[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Trying to capture a method on a nested class

Hugh McBride wrote:

To all

I have a series of classes i.e CookieObject, RaisinObject, FlourObject,
ButterObject etc that are contained in another class called CookieRecipe and
are set like so

public class CookieRecipeLoader
CookieRecipe.getCookie().setValue(new CookieObject());
CookieRecipe.getRaisin().setValue(new RaisinObject());
CookieRecipe.getFlour().setValue(new FlourObject());


I am trying to generate a error when the setValue is called on any
Of the getters i.e. getCookie(), getRaisin() etc

Um, your semantics are incorrect - you are not invoking the setValue method on any of the getter methods, rather, you are invoking the setValue method on the /return value/ from the getter methods.

That is, your statements above are semantically equivelant to:
Cookie c = CookieRecipe.getCookie();
c.setValue(new CookieObject());

Have tried the code below

declare error: call((* CookieRecipe.get*.setValue(..) ) &&
!within(CookieRecipeLoader)): "Illegal to add Ingredient outside cookie";

It seems that I cant get past the getters, does anyone know the right syntax

To use , or can it be done at all

Hugh McBride

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.
aspectj-dev mailing list

fn:Keven Ring
org:Center for Innovative Computing and Informatics;W908
adr;dom:;;7515 Colshire Drive;McLean;VA;22102
title:Lead Software Systems Engineer