Bug 41785 - declare and pointcut as identifiers cause parsing problems
Summary: declare and pointcut as identifiers cause parsing problems
Status: RESOLVED DUPLICATE of bug 37069
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-21 07:36 EDT by Wes Isberg CLA
Modified: 2003-08-25 13:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Isberg CLA 2003-08-21 07:36:14 EDT
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 {}
Comment 1 Jim Hugunin CLA 2003-08-25 13:13:02 EDT
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.
Comment 2 Jim Hugunin CLA 2003-08-25 13:28:23 EDT
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 ***