Bug 287613 - declare @method/field/constructor don't work with compound patterns
Summary: declare @method/field/constructor don't work with compound patterns
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 1.6.9   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-25 16:11 EDT by Ramnivas Laddad CLA
Modified: 2010-06-18 18:56 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;