Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to remove "abstract" with AspectJ?

Hi,

On 16 February 2010 18:27, Hendy Irawan <hendy@xxxxxxxxxxx> wrote:
>
> Is it possible to remove "abstract" from a class using an aspect? The AspectJ
> second edition book by Ramnivas doesn't seem to mention this.

No, AspectJ doesn't do that.

I see what you are saying though, that by ensuring there is a complete
implementation of all the missing methods, AspectJ could consider the
type no longer abstract, but I would need to think about it a little
more.  I'm not sure 'abstract' is only used when there are methods
that are abstract, there are other situations when you might want to
use it where, for example, you just want to prevent construction of
that type.

But then I am only thinking about code style.  With pure annotation
style, something like this:

> Project project = new Project();
> project.setName("Hello");

can never be allowed to compile, because you are free to use javac to
compile annotation style.  javac won't allow that so ajc with
annotation style won't allow it as we cannot modify the type system
for annotation style in the same way as we can for code style.

So 'removing abstract' is possibly a feasible enhancement for code
style (but I'd need to think about further), but I'm afraid it is not
a suitable enhancement for annotation style.

cheers,
Andy


Back to the top