Bug 287613

Summary: declare @method/field/constructor don't work with compound patterns
Product: [Tools] AspectJ Reporter: Ramnivas Laddad <ramnivas>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: aclement
Version: DEVELOPMENT   
Target Milestone: 1.6.9   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ramnivas Laddad CLA 2009-08-25 16:11:27 EDT
The following aspect issues errors for each of the statements, which it should not:
aspect DeclareAnnot {
    declare @method: * *.get*() || boolean *.is*(): @Annot;
    
    declare @field: String *.* || boolean *.* : @Annot;

    declare @constructor: Person.new() || Person.new(*) : @Annot;

    declare @method: * *.get*() && boolean *.is*(): @Annot;
    
    declare @field: String *.* && boolean *.* : @Annot;

    declare @constructor: Person.new() && Person.new(*) : @Annot;
    
    declare @method: !(* *.get*()): @Annot;
    
    declare @field: !(String *.*) : @Annot;

    declare @constructor: !(Person.new()) : @Annot;
}

In each of the cases, simple expressions (without ||, &&, or !) work. declare @type works even with ||, &&, or !
Comment 1 Ramnivas Laddad CLA 2009-08-25 18:43:12 EDT
Just to add that I tried putting parentheses around individual patterns; that didn't work either.
Comment 2 Andrew Clement CLA 2009-08-26 15:21:08 EDT
this is actually working as currently designed.  Some reasonably serious changes would be needed to support this extension to the syntax, and the serialized form of the aspect would change as they are currently coded to hold a single ctor/field or method signature pattern, and not a compound pattern.
Comment 3 Andrew Clement CLA 2010-06-18 18:56:44 EDT
as 1.6.9 is changing the serialized format, I'm cramming any changes in that also need a change in format.

This is now committed.  I had to build new infrastructure for handling compound signature patterns and it is only used by declare annotation field/method/constructor.

It is a little keen on requiring parentheses, but I don't think that is a big deal.  In your example:

    declare @method: * *.get*() || boolean *.is*(): @Annot;

must be expressed as

    declare @method: (* *.get*()) || (boolean *.is*()): @Annot;