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.

Example:

@NameableMixin2
public abstract class Project implements Nameable { }

The rationale of using abstract & implements is to avoid need of:
  ((Nameable))project).getName()

and just use:
  project.getName()

@NameableMixin2 implemented using @AspectJ-notation aspect:

@Aspect
public class NameableAspect2 {

        @DeclareMixin("@NameableMixin2 *")
        public Nameable nameableMixin() {
                return new NameableImpl();
        }
        
}

Let's say that NameableImpl is a complete implementation of Nameable.

Therefore, Project should no longer be abstract.

But when I do this:

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

I get "Cannot instantiate the type Project", which is understandable because
it's (originally) abstract.
I want to un-abstract the Project using AspectJ, how do I do this?

-----
http://www.Soluvas.com/ Soluvas - Making eCommerce Work for You 
-- 
View this message in context: 
http://old.nabble.com/How-to-remove-%22abstract%22-with-AspectJ--tp27617645p27617645.html
Sent from the AspectJ - users mailing list archive at Nabble.com.

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to