Community
Participate
Working Groups
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 "); } }
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.
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.
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 ."
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
Fix released as part of AspectJ 1.2.1