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

For me it only works if i do the cast Bhaskar Maddala suggested.Is this normal?



I'm within an eclipse project so i just save and it compiles alone. Didn't understand your question, sorry.

If i defined the aspect like :

aspect example{

   public interface Ola{};
    declare parents: Client implements Ola;

}

and still continue with the same code in class Client is it normal that it gives and error saying  "Ola cannot be resolved to a type"

On Dec 13, 2007 9:06 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
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
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users