[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] PointCut problem
|
Hi -
Classes are always initialized within the scope of the class
(see staticinitialization(T)).
To limit constructor calls, try something like
declare error: !within(Y) && call(packageK..*.new(..)) :
"Y is factory for all packageK";
I'm not sure there's a *general* way to permit any class to call
its own constructor (e.g., in its own static methods). For a
specific class, you can say
declare error: !within(Y) && !within(SomeClass) &&
call(SomeClass.new(..)) : "Y is factory for all packageK";
Remember that this() and super() calls are not join points, so
this code would not trigger any declare-error:
SomeClass() { this("default"); }
SomeClass(String s) { this.name = s; }
So you might not need to permit a class to call its own
constructor.
Hope this helps -
Wes
------------Original Message------------
From: João Batalha <joao.batalha@xxxxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Fri, Feb-25-2005 6:34 AM
Subject: [aspectj-users] PointCut problem
Hello
I'm trying to create an aspect that gives an compiler error when this doesn't occur:
- all the classes inside the package K can only be initialized inside a especific class Y or inside the scope of the especific class.
I created this one that gives the error but permits the initialization of any class that is inside the package K be done by any other of that same package
pointcut ActionsInstancesCreation() : !within(packageK..*) && !within(Class Y) && initialization(packageK..new(..));
Can i do a pointcut to resolve my error?
--
João Batalha
joao.batalha@xxxxxxxxxxxx
+ 351 91 220 20 13
_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxx http://dev.eclipse.org/mailman/listinfo/aspectj-users