Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Why declare warning: is not working?

Also, just as a "sanity check", make sure you have an AspectJ, not Java, Project. The project folder will have a little "AJ" in the icon.

dean

On Oct 10, 2007, at 4:22 AM, Gijs Peek wrote:

If your eclipse project is properly set-up, eclipse should show the warning
(both in the problems tab and as a warning symbol on the left of the
System.out.println line) . The code will indeed still compile and run
normally as you declared a warning, not an error.

cheers,
 - Gijs

On Wednesday 10 October 2007 11:10:18 Mallik wrote:
HI Peek,
That's what i am not getting.
i am using eclipse IDE, when i run the application, it is not showing any
compile time error, just running normally. Is this with IDE or any?
and how to just compile in eclipse ide.

regards
Mallik Avula

Gijs Peek <gijs.peek@xxxxxxxxx> wrote: I don't know what you mean with 'is not working' as you didn't tell what you thought it should do, but I think your pointcut is working fine. If I create the following aspect and class:
aspect SysAccess {
        pointcut sysAccess(): get(* System.out);

    declare warning: sysAccess():
        "Access Denied";
}

class HelloWorld {
        public static void main(String[] args) {
                System.out.println("Hello, world!");
        }
}
and compile them (ajc SysAccess.aj HelloWorld.java) it will neatly generate
a compiler warning, because my HelloWorld class tries to access the
System.out field.

cheers,
 - Gijs

On Wednesday 10 October 2007 07:42:42 Mallik wrote:
HI i am very new to AspectJ and to this mailing list.
i am trying some examples, but declare warning is not working.
this is my code:
------------------------------------------------
pointcut sysAccess(): get(* System.out);

    declare warning: sysAccess():
        "Access Denied";
------------------------------------------------
why it is not working?
can anybody explain?

regards
Mallik Avul


---------------------------------
Pinpoint customers who are looking for what you sell.


--
Scotty:	Captain, we din' can reference it!
Kirk:	Analysis, Mr. Spock?
Spock:	Captain, it doesn't appear in the symbol table.
Kirk:	Then it's of external origin?
Spock:	Affirmative.
Kirk:	Mr. Sulu, go to pass two.
Sulu:	Aye aye, sir, going to pass two.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com  AOP advocacy site
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5

I want my tombstone to say:
  Unknown Application Error in Dean Wampler.exe.
  Application Terminated.
      [Okay]        [Cancel]





Back to the top