Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] feature suggestion for comment: error messages for declare.error/warning

Hi Ron,

just a comment: maybe have a look into our "parametric introduction" paper at AOSD '03 or the our AspectJ design constraints paper:
http://www.cs.uni-essen.de/dawis/publications/papers/aop/HaUn_SpecifyingAspectOrientedDesignConstraints_OOPSLA_WS_2002.pdf
from my point of view this seems to be a nice feature and it would be great it this would be directly supported by AspectJ.

- Stefan

Ron Bodkin wrote:
In many cases, when I have written declare error or declare warning, I'd like to be able to craft a context-sensitive message. For example, consider:

declare error: set(private * *.*) && !inSetterOrConstructor():
    "don't set privates directly, use a setter";

If we had access to thisJoinPointStaticPart and a printf-style/message format-style language this could be improved to be:

declare error: set(private * *.*) && !inSetterOrConstructor():
    "don't set {0}{1}.{2} directly, use a setter",
getDeclaringType().getPackage(), getDeclaringType().getName(), getName();

This implicitly uses thisJoinPointStaticPart as the scope for evaluating the message text; I am guessing that this is fairly reasonable to implement, whereas doing anything more is a lot of work.

I'd be interested in feedback from other users. Would you find this useful? Are there other elements of this you'd like to see? I'm also interested in comments from the committers on how hard it would be to implement this (and how to design it to make it feel natural yet make implementation tractable).

This idea first came up in discussion with an AspectJ user at a tutorial I was giving; thank you for suggesting it.

Ron

p.s. Here's an example of something that would be nice to do, but I believe would be a lot of work to implement:

declare error: set(private * *.*) && !inSetterOrConstructor():
    "don't set {0}.{1} directly, use {2}",
    Util.getFullyQualifiedName(thisJoinPoint.getDeclaringType()),
    thisJoinPoint.getName(),
    Util.findSetter(thisJoinPoint.getDeclaringType(),
                    thisJoinPoint.getName());

Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users



--
*******************************************************
Stefan Hanenberg
University of Duisburg-Essen
Institute for Computer Science
and Business Information Systems (ICB)
phone: (+49) 201-183 3678 | fax: (+49) 201-183 2419
email: mailto:shanenbe@xxxxxxxxxxxxxxx
www: http://www.cs.uni-essen.de/dawis/staff/shanenbe/
*******************************************************



Back to the top