Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Re: declare parents and inheritance

It works for me. Maybe you aren’t weaving into Parents and/or Child?

 

public aspect DeclareParents {

    declare parents: Parent implements IInterface;

 

    private boolean IInterface.isInterface() {

        return true;

    }

 

    public static void main(String args[]) {

        System.out.println(new Child().isInterface());

    }

}

 

interface IInterface {}

class Parent {}

class Child extends Parent {}

 

C:\devel\scratch>ajc DeclareParents.aj

 

C:\devel\scratch>java DeclareParents

true

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Alexandru Popescu
Sent: Tuesday, March 14, 2006 5:28 PM
To: userAJ
Subject: [aspectj-users] Re: declare parents and inheritance

 

I have tried also with declare parents Parent+ implements IInterface, but no good result. I am definitely doing something wrong.

./alex
--
.w( the_mindstorm )p.

On 3/15/06, Alexandru Popescu <the.mindstorm.mailinglist@xxxxxxxxx> wrote:

Hi!

Maybe this is a stupid question, but at this moment I don't have a good answer for it (sorry 3am):

if Child extends Parent and declare parents Parent implements IInterface, isn't supposed to have the condition (Child instanceof IInterface) true? Or should I declare parents with:

declare parents Parent+ implements IInterface?

thanks and sorry for the "stupid" question,

./alex
--
.w( the_mindstorm )p.

 


Back to the top