Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] finding static field declarations

On 10/19/07, Mike Schneider <mikepschneider@xxxxxxxxx> wrote:
> How would I write an aspect that would restrict the use of static fields?
>
> Such that compiling something simple like this:
>
> class X {
>     static int c; // bad
>     int d;          // ok
> }
>
>
> would result in a compiler warning/error for c, but not d.

Using hasfield pointcuts, it would be possible to at least emit a
warning/error for the class, I guess. It is an experimental feature
though:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=86818

If you like it, vote for it.

Regards,
Michael Nascimento Santos
https://genesis.dev.java.net/
https://jsr-310.dev.java.net/


Back to the top