Bug 61535 - Front End Bug, if* should be a valid name pattern
Summary: Front End Bug, if* should be a valid name pattern
Status: REOPENED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: All other
: P5 trivial (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-09 12:48 EDT by Laurie Hendren CLA
Modified: 2009-08-30 02:51 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 Laurie Hendren CLA 2004-05-09 12:48:08 EDT
Can't handle pattern like *if,  

public class Test {
  public static int if1(int x) // 1st before advice should match here
   { return(x+1);
   }

  public static int while1(int x) // 2nd before advice should match here
   { return(x+1);
   }

  public static void main(String args[])
    { System.out.println(if1(1));
      System.out.println(while1(1));
    }
}

aspect Aspect {
  before() : call(int if*(int)) && within(Test) // this causes a parse error in 
ajc
    { System.out.println("before method starting with if");
    }

  before() : call(int while*(int)) && within(Test)  // this is ok
    { System.out.println("before method starting with while");
    }
}
Comment 1 Jim Hugunin CLA 2004-05-10 13:51:35 EDT
Thanks for the simple and clear bug report.  This is a valid bug; however, I'm 
marking it a P4 because it is a little bit hard to fix, and the problem is a 
minor one.  If it was available, I'd mark this with a 1.3 milestone.

The parser for name patterns goes to a lot of work to handle all of the 
standard java keywords as part of a name pattern.  To do this, all of the 
keyword tokens that come out of the jdt's parser are converted to name tokens 
for our parser (in org.aspectj.weaver.patterns.PatternParser).

The one exception to this is the if keyword which we currently use the jdt's 
grammar and parser to produce a single IfPseudoToken out of 'if' '(' 
<expr> ')'.  Reusing the jdt's java parser (in 
shadows/org.eclipse.jdt.core/grammars/java_14.g) to parse the if expression is 
essential to our integration with the jdt.

Fixing this bug will require carefully looking at our modified jdt grammar and 
parser + our custom PatternParser.  The case that I think will be hardest to 
handle is something like, 'call(* *if(x))'.  In this case, I don't see how our 
pseudo token stream code can tell the difference between the pcd 'if(x)' and 
the name pattern '*if'.

This bug is fairly well localized to the two parsers and is the kind of bug 
that would be much likelier to be fixed with an attached patch.
Comment 2 Adrian Colyer CLA 2005-08-26 11:04:23 EDT
We're not going to get to this in AJ 1.5.0. Marking as "LATER" for consideration
in 1.5.1 and future release planning.
Comment 3 Eclipse Webmaster CLA 2009-08-30 02:51:13 EDT
LATER/REMIND bugs are being automatically reopened as P5 because the LATER and REMIND resolutions are deprecated.