Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Inter-Type constructor

No. I think you can't redefine a method/constructor. You just can create new methods/contructors, but the empty constructor is always defnided (for you, or for the compiler). So, to redifine this constructor, probably you will have to use 'around'.

On Dec 16, 2007 2:04 AM, Renato Rodrigues <renatolmsrodrigues@xxxxxxxxx> wrote:
So i have to define an empty constructor so i can redefine it with inter-type declaration? I can't just add a constructor like i can add a method?


On Dec 15, 2007 11:50 PM, Rui Carlos Gonçalves < rui.c.a.g@xxxxxxxxx> wrote:
I think in Java if you don't create a empty constructor, the compiler will do that. So, you are trying redefine a constructor already exists. If you try 'public Client.new(int x)' instead of 'public Client.new ()' you don't have any error. Maybe you can use 'Client around() : call(Client.new()) {...}' in your case.

Regards,
Rui Gonçalves

PS: sorry by bad english :)

On Dec 15, 2007 4:02 PM, Renato Rodrigues <renatolmsrodrigues@xxxxxxxxx > wrote:
I want to define the Client constructor in the aspect instead of the class itself. Shouldn't it be like this? The compiler says :
inter-type declaration from declare_question.X conflicts with existing member: void declare_question.Client.<init>()    ola/src/declare_question    X.aj    line 6   
------------------------------------------
package declare_question;


package declare_question;

public class Client {
   
    public static void main(String[] args) {
           Client o = new Client();
       }
}
--------------------------------------------------

package declare_question;

public aspect X {

    public Client.new(){
        System.out.println("cliente");
    }
}

_______________________________________________
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



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top