I'm glad you made some headway. I'm not sure if your original
installation process caused problems. I think it should have worked,
but I've only used the feature installer myself.
I do believe it's wise to proceed cautiously, since as you've seen, it
can take some effort to understand the join point language and other
aspects (pardon the pun ;) of AspectJ. I don't know what other aspects
you've tried to use, but "policy enforcement" aspects like the one you
posted are a good place to start, since they don't implement production
functionality, but provide a supporting development role. As you build
confidence, you can proceed to more "missing critical" aspects.
Best wishes.
dean
Kevin F wrote:
Paulo
& Dean, thank you for your replies. I had given up and was
actually in the process of purging AspectJ from my project when they
arrived. So, I copied my AspectJ-free project to a new directory and
used the Eclipse option to convert to AJ project. I didn’t think your
suggestions were going to help since the failure I had been getting
were on the _expression_ “within(com.mycompany..*+)”; however, I tried
anyway.
Amazingly, things seemed to behave exactly as they should. With this
happy event, I tried the tests from my original posting. At the time
of posting, the pointcut “within(com.mycompany..*+)” allowed 118 join
points. Now, it allows > 3000 which is approximately what I
expected.
When I thought back on my installation within Eclipse 3.2.1, I
downloaded AJDT from eclipse.org, extracted the file, copied the
features to .../eclipse_3.2.1/features/, and copied the plugins to
.../eclipse_3.2.1/plugins. When I installed AJDT for Eclipse 3.3M5, I
used the feature installer. Is it possible that an improper
installation the first time caused my AJ project to be setup
incorrectly and caused all my problems?
Due to my 4 days of pain, I am a bit timid at the moment; however, I
want to believe that AJ is stable and reliable because
- it is used in a lot of projects
- it has the awesome power (for good or bad) to
make massive changes to the code that I write
Thanks again for the responses,
Kevin
From: Kevin F
<aj@xxxxxxxxxxxxxxxxxxxxxxx>
Reply-To: <aspectj-users@xxxxxxxxxxx>
Date: Sun, 25 Feb 2007 08:07:22 -0500
To: <aspectj-users@xxxxxxxxxxx>
Conversation: Frustrated Newbie
Subject: [aspectj-users] Frustrated Newbie
I’ve been at this for 4 days now. I had some
good luck with a few initial cases where I was able to clean up some
code and verify through testing it worked like a charm. I made a
couple minor tweaks to those which broke them giving the technology an
unreliable feel. I’m willing to write that off as inexperience.
So I continued on and tried to implement some simple enforcement
policies that I read in the book from the Eclipse Series (trying to
support development by buying products and all). It isn’t working at
all and my frustration level trying to implement even simple
enforcement policies is off the scale.
Yesterday, I posted the following to the AspectJ newsgroup without a
response yet. I continued researching on my own, even using the latest
milestone AspectJ release for Eclipse 3.3M5. Still no luck.
---------------
Newsgroup post:
---------------
I'm new to AspectJ so please no flames. I'm using AJDT for Eclipse
3.2.1
and have been following the details from the "eclipse AspectJ" book.
I'm trying to enforce simple errors such as "It is an error to
implement any
listener interface unless you also implement interface Foo." To do
this, I
want to try:
pointcut listeners() : within(*..*Listener*+);
pointcut myCode() : within(com.mycompany..*+);
pointcut mySpecialInterface() : within(com.mycompany.Foo+);
declare error: listeners() && myCode() &&
!mySpecialInterface()
: "All listeners must implement Foo";
Since this did not work, I tried various experiments. So, I tried the
following:
declare error: within(*..*Listener*+)
: "A";
declare error: within(com.mycompany..*+)
: "B";
declare error: within(*..*Listener*+) &&
within(com.mycompany..*+)
: "A intersect B";
declare error: within(*..*Listener*+ && com.mycompany..*+)
: "A intersect' B";
declare error: within(*..*Listener*+) || within(com.mycompany..*+)
: "A union B";
declare error: within(*..*Listener*+ || com.mycompany..*+)
: "A union' B";
A seems to be tagged correctly on all classes that implement any
interface
with the word Listener in its name.
B seems to tag only a fraction of the classes I have written.
A intersect B and A intersect' B both result in no tags.
A union B and A union' B both seem to result in the union of what A and
B
tagged above.
AOP seems so powerful yet so cryptic. Can anybody help?
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
|