Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] declare question

I'm not quite sure what you are doing, but that program compiles fine for me:

---- Client.java ---- 8<----
interface Ola {}

public class Client {
    Client(){};

    public int num1(){
        return 1;
    }

    public void aux()
    {
        Ola o = new Client();
    }
}

 aspect example{


     declare parents: Client implements Ola;

}
---- Client.java ---- 8<----

C:\aspectj1.5-dev>ajc -showWeaveInfo Client.java
Extending interface set for type 'Client' (Client.java) to include
'Ola' (Client.java)

Are you compiling all from source? are you binary weaving in some way?
it should be fine.  You *might* get a eager parsing bug in the eclipse
editor as it isnt aware the aspect will make everything alright at
compile time?

Andy.

On 13/12/2007, Renato Rodrigues <renatolmsrodrigues@xxxxxxxxx> wrote:
> Im a newbie to AspectJ and i'm trying to do a simple declare parents
> expression so a Class can implement an interface
>
> i have class:
>
>
> public class Client {
>     Client(){};
>
>     public int num1(){
>         return 1;
>     }
>
>     public void aux()
>     {
>         Ola o = new Client();
>     }
> }
> and aspect :
>
>
> public aspect example{
>
>
>      declare parents: Client implements Ola;
>
> }
>
>
> and the compiler says Type mismatch: cannot convert from Client to Ola
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top