[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RES: [aspectj-users] Declare error
|
Hi Jitesh,
The problem is that I would like to do this in compile time, using errors or
warnings...
Andre
-----Mensagem original-----
De: aspectj-users-admin@xxxxxxxxxxx [mailto:aspectj-users-admin@xxxxxxxxxxx]
Em nome de JITESH KALYANI Shivanand
Enviada em: sexta-feira, 26 de março de 2004 16:41
Para: aspectj-users@xxxxxxxxxxx
Assunto: RE: [aspectj-users] Declare error
HI,
I have tried small example. We can have poincut to constructor and check if
it is default constructor OR prameterised constructor. If it is prameterised
constructor, throw error. See if this u want.
class constructorTest
{
int a = 0;
public static void main(String[] args)
{
constructorTest obj1 = new constructorTest();
constructorTest obj2 = new constructorTest(10);
System.out.println("Program Over!");
}
public constructorTest() {
System.out.println("Executing Default Constructor");
}
public constructorTest(int a) {
this.a = a;
System.out.println("Executing parameterised Constructor : a
= "+a);
}
}
aspect testaspect
{
pointcut myConstructor() : within(constructorTest) &&
execution(constructorTest+.new(..));
before (): myConstructor() {
Object[] args = thisJoinPoint.getArgs();
if(args.length == 0) {
System.out.println("Default Constructor");
}else {
System.out.println("Parameterised Constructor");
//throw error.
}
}
}
Jitesh
> ----------
> From:
aspectj-users-admin@xxxxxxxxxxx[SMTP:aspectj-users-admin@xxxxxxxxxxx] on
behalf of André Dantas Rocha[SMTP:ad-rocha@xxxxxxxxxx]
> Reply To: aspectj-users@xxxxxxxxxxx
> Sent: Friday, March 26, 2004 5:17 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RES: [aspectj-users] Declare error
>
> I don't know how to....
>
> _____
>
> De: aspectj-users-admin@xxxxxxxxxxx
> [mailto:aspectj-users-admin@xxxxxxxxxxx] Em nome de Nicholas Lesiecki
> Enviada em: sexta-feira, 26 de março de 2004 01:51
> Para: aspectj-users@xxxxxxxxxxx
> Assunto: Re: [aspectj-users] Declare error
>
>
> Possibly. Can you write an attempt at doing this and submit it to the
list?
>
> Nick
> On Mar 25, 2004, at 12:53 PM, André Dantas Rocha wrote:
>
>
>
> Hi,
>
> I would like to declare an error if any subtype of ClassA do not have a
default constructor.
> Is it possible?
>
> Thanks
>
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users