Bug 292264 - Enhance declare error to support type patterns
Summary: Enhance declare error to support type patterns
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 1.6.9M1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-14 10:07 EDT by Matthew Adams CLA
Modified: 2010-04-16 13:10 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 Matthew Adams CLA 2009-10-14 10:07:24 EDT
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: 

Currently, declare error only accepts a pointcut expression.  It would
be nice if it also accepted a type pattern.

For example:

declare error: (@Endable *) && (!hasmethod(protected * end(Date)) :
"no protected end(Date) method";

It's kind of like compile-time enforcement of interface methods, only
I want it to support non-public methods. 

See mailing list post:
http://www.nabble.com/declare-error---type-pattern--to25619498.html#a25619498


Reproducible: Always
Comment 1 Andrew Clement CLA 2009-10-14 11:55:34 EDT
put some thought into this for 1.6.7
Comment 2 Andrew Clement CLA 2010-01-26 19:35:37 EST
After some initial thinking, I'm looking at these constructs:

declare type warning: <typepattern>: <message>

declare type error: <typepattern>: <message>
Comment 3 Andrew Clement CLA 2010-04-05 18:26:55 EDT
committed basic support for this.  Syntax is the same as for regular deow

declare warning: hasmethod(* foo(..)): ""

there is no 'declare type warning'.
Comment 4 Matthew Adams CLA 2010-04-06 12:24:02 EDT
Very nice!  Just curious:  why no "declare type warning"?  No time to do it, or is there some more fundamental issue?
Comment 5 Andrew Clement CLA 2010-04-06 12:48:51 EDT
"declare type warning" requires me to define a new pseudo token 'type' and modify the grammar, regenerate the parser then re-integrate the generated parser into the compiler.  That is a very messy process.  Overloading "declare warning" requires none of that.
Comment 6 Matthew Adams CLA 2010-04-06 13:55:18 EDT
Please confirm:

* There are two constructs "declare warning" and "declare error" and they can take type expressions or pointcut expressions.

* There are no "declare type error" and "declare type warning" statements.
Comment 7 Andrew Clement CLA 2010-04-06 13:57:14 EDT
> There are two constructs "declare warning" and "declare error" and they can
> take type expressions or pointcut expressions.
>
> There are no "declare type error" and "declare type warning" statements.

that's right.
Comment 8 Matthew Adams CLA 2010-04-06 13:59:47 EDT
Excellent!  Thanks for adding that!