Newbie -- Syntax error with field get/set pointcut [message #71559] |
Thu, 24 April 2008 23:08 |
Eclipse User |
|
|
|
Originally posted by: kkraft.mcn-inc.com
Hi,
I'm not sure if this is the right forum, but I didn't see anything else
AspectJ-related.
I am using AspectJ in Eclipse with the AJDT plug-in.
I have a basic HelloWorld.java class with a String attribute called
"message". I was able to define a working execution pointcut on
getMessage(), but when I attempt to define a get or set pointcut on the
message field Eclipse reports a syntax error:
Syntax error on token ";", invalid allowable token in pointcut or type
pattern
Here are my attempts at defining the get/set pointcuts::
pointcut getMessage() : get(String HelloWorld.message);
pointcut setMessage(String m) : set(String HelloWorld.message);
I have tried all kinds of signatures inside the get/set calls, e.g.
"String message", "* message", "String *", but I always get the syntax
error. One other odd note it that the syntax error always appears at the
end of the last pointcut (e.g. "setMessage()", in the above case). Also,
the error only appears when I try to reference the pointcut in advice.
Here is what that looks like:
before : getMessage() {
System.out.println("RUNNING ADVICE BEFORE " + thisJoinPoint);
}
Can anybody tell me what's going on here?
Many thanks.
|
|
|
Re: Newbie -- Syntax error with field get/set pointcut [message #71578 is a reply to message #71559] |
Sat, 26 April 2008 00:38 |
Eclipse User |
|
|
|
Originally posted by: kkraft.mcn-inc.com
OK, I figured out the problem and it turned out to be in the advice code
(which I didn't include in the original post). Here is the gist of it:
pointcut getMessage() : get(String HelloWorld.message);
before : getMessage() {
System.out.println("GET POINTCUT: RUNNING ADVICE BEFORE " +
thisJoinPoint);
}
I forgot the parentheses after "before" (should be "before()"). Sorry, my
bad... :(
|
|
|
Re: Newbie -- Syntax error with field get/set pointcut [message #596868 is a reply to message #71559] |
Sat, 26 April 2008 00:38 |
Eclipse User |
|
|
|
Originally posted by: kkraft.mcn-inc.com
OK, I figured out the problem and it turned out to be in the advice code
(which I didn't include in the original post). Here is the gist of it:
pointcut getMessage() : get(String HelloWorld.message);
before : getMessage() {
System.out.println("GET POINTCUT: RUNNING ADVICE BEFORE " +
thisJoinPoint);
}
I forgot the parentheses after "before" (should be "before()"). Sorry, my
bad... :(
|
|
|
Powered by
FUDForum. Page generated in 0.02757 seconds