[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] code policy enforcement and AspectJ
|
Hello Leif,
I had a similar question some time back (and others have had similar
questions on this list as well) and from what I gather from responses is
that it appears aspectJ can not determine "this" outside of runtime at this
point. Anyone, please correct me if I'm wrong.
Regards,
David Suarez
"leifo Lauvsnes" <leifo@xxxxxxxxxxx>@eclipse.org on 19 Feb 2004 09:54
Please respond to aspectj-users@xxxxxxxxxxx
Sent by: aspectj-users-admin@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
Subject: [SPAM]: [aspectj-users] code policy enforcement and AspectJ
****************************************************************************
This message originated from the Internet. Its originator may or
may not be who they claim to be and the information contained in
the message and any attachments may or may not be accurate.
****************************************************************************
I'm trying to write an aspect that helps me enforce that member values
should only be changed from methods named set*, and from the
constructor(s),
in the same class that the member variable belongs to. Is it possible to do
this at compile time? The problem is to deny(flag warning)
constructors/methods in other classes from assigning variables. The aspect
should be generic, so !withincode(someSpesificClass.new(..)); doesn't help
me.
Hopefully you understand my question, and have some ideas
aspect that try to explain my idea but doesn't work (doesn't compile):
{
pointcut notSelfCall(Object caller, Object callee) :
set (* *.* && ) !withincode(*.new(..))
this(caller) && target(callee) && caller != callee;
pointcut directMemberAssignment() :
set (* *.*) && !withincode(* set*(..)) &&
!withincode(*.new(..));
declare warning : directMemberAssignment() &&
notSelfCall(caller, callee) :
"Use a setter method for assignment. Constructors in other class can't
assign values";
}
-Leifo
_________________________________________________________________
MSN Messenger http://www.msn.no/messenger Den korteste veien mellom deg og
dine venner
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users
************************************************************************
This E-mail is confidential. It may also be legally privileged. If you
are not the addressee you may not copy, forward, disclose or use any
part of it. If you have received this message in error, please delete
it and all copies from your system and notify the sender immediately
by return E-mail.
Internet communications cannot be guaranteed to be timely, secure,
error or virus-free. The sender does not accept liability for any
errors or omissions.
************************************************************************