Community
Participate
Working Groups
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
put some thought into this for 1.6.7
After some initial thinking, I'm looking at these constructs: declare type warning: <typepattern>: <message> declare type error: <typepattern>: <message>
committed basic support for this. Syntax is the same as for regular deow declare warning: hasmethod(* foo(..)): "" there is no 'declare type warning'.
Very nice! Just curious: why no "declare type warning"? No time to do it, or is there some more fundamental issue?
"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.
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.
> 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.
Excellent! Thanks for adding that!