Bug 61536 - Front-end bug, shouldn't allow patterns of the form foo.., should be foo..*
Summary: Front-end bug, shouldn't allow patterns of the form foo.., should be foo..*
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: All other
: P4 minor (vote)
Target Milestone: 1.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-09 12:50 EDT by Laurie Hendren CLA
Modified: 2004-10-21 04:31 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:50:40 EDT
See following code:

public class Test2 {
  public static void main(String args[])
    { System.out.println("Hi");
    }
}

aspect Aspect2 {
  // shouldn't one have to say,  java..* instead of java.. in the following??
  // Note that the first advice (incorrect one) passes the front-end, but does
  // not match,  whereas the second one does match.   I believe the front-end
  // should reject the first one.
  before () : call( * java..(..)) && within(Test2)
    { System.out.println(
        "Incorrect One: Before a call of method in a java package ");
    }

  before () : call( * java..*(..)) && within(Test2)
    { System.out.println(
        "Correct One: Before a call of method in a java package ");
    }
}
Comment 1 Jim Hugunin CLA 2004-05-10 13:54:27 EDT
Thanks for another clear bug report.  This is also a valid bug, but not a 
super serious one.  This should be fixed after the emminent 1.2 release.

This should be an easy bug to fix from the code in 
org.aspectj.weaver.patterns.PatternParser.  That's a fairly simple hand-coded 
LL(k) recursive decent parser for pointcut patterns.  Fixing this bug should 
be a straightforward process and completely contained within that single file.
Comment 2 Laurie Hendren CLA 2004-05-11 01:43:24 EDT
I think this a potentially dangerous bug because I did find some old examples
or documentation around that seemed to use the form  java.. (sorry I don't
remember where I saw it).  

It is a minor bug to accept something like "java.." when the programmer
really means "java..*".  However, if it "java.." is silently accepted by the
front-end,  but not matched by the back-end (as my example bug report shows),
then I think it is more serious.

If it is simple to fix, I think you should fix it for 1.2.

Comment 3 Andrew Clement CLA 2004-07-29 08:59:01 EDT
Fixed in CVS, waiting for build then I'll close the bug.

I also fixed the case of ending a name pattern with a '.' that isn't included in
the original bug report.  That is less common as you typically get a message
about not finding a type that matches.  (You now get a message saying its an
badly formed pattern).

Parser errors that can come out now include:

"name pattern cannot finish with .." 
                         
"name pattern cannot finish with ."
Comment 4 Andrew Clement CLA 2004-07-30 03:29:57 EDT
Fixed in developer build available from our download page.

BUILD COMPLETE -  build.320
Date of build: 07/29/2004 17:22:44
Time to build: 120 minutes 38 seconds
Last changed: 07/29/2004 16:51:45
Latest good AspectJ jar available at: 
download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar
Comment 5 Adrian Colyer CLA 2004-10-21 04:31:58 EDT
Fix released as part of AspectJ 1.2.1