Skip to main content

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

Renato, I think this might be considered an ajc bug. Rui is right that
Java defines a non-argument constructor by default if non is given,
however I see no reason for why an ITD should not be able to "fill in"
this constructor. I guess it should be possible to file a bug report
to clear this up.

In the meantime you can use an advice to intercept constructor calls
to this type, perhaps.

Eric

On 15/12/2007, 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
>
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top