Community
Participate
Working Groups
ajc issues syntax errors for "pointcut" or "declares" in some cases when used outside the scope of an aspect. (This is a follow-up the George's aspectj-dev email wrt 1.1.1rc1 ajc-aspectj test failing because of compile errors.) --------- // compiles correctly with javac 1.4 but ajc 1.1 issues syntax errors public class Keywords { public static void main(String[] a) { Object declare = new Object(); if (declare instanceof declare) { throw new Error("bad negative declare instanceof check"); } declare = new declare(); if (!(declare instanceof declare)) { throw new Error("bad positive declare instanceof check"); } Object pointcut = new Object(); if (pointcut instanceof pointcut) { throw new Error("bad negative pointcut instanceof check"); } pointcut = new pointcut(); if (!(pointcut instanceof pointcut)) { throw new Error("bad positive pointcut instanceof check"); } } } class declare {} class pointcut {}
The AspectJ parser defined the following additional keywords: aspect pointcut around before after declare privileged The grammar tries to allow these names to be used in most places where a JavaIdentifier is allowed, but it's currently quite incomplete. Addressing this bug would make a great project for someone who's not scared of LR parser generators. The task is to try to fix the grammar (in shadows/org.eclipse.jdt.core/grammars/java_1_4.g) to allow the additional AspectJ keywords in the position of a JavaIdentifier as often as possible without producing parsing conflicts. Then the next task would be to clearly specify those few places where this isn't possible and the above terms need to be treated as reserved. Of course, anyone who started to get involved with the AspectJ grammar would hopefully be tempted to look at moving it to java_1_5.g as well looking toward the future.
I'm marking this as a duplicate of a previous report about aspect being allowed as a package name in order to keep all of the pseudo-keyword grammar issues in one place. *** This bug has been marked as a duplicate of 37069 ***