Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Assignment to final field on inter-type declaration in initializer

Dear Wes, and all,

From: Wes Isberg <wes@xxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] Assignment to final field on inter-type declaration in initializer
Date: Tue, 05 Aug 2003 22:55:38 -0700

> As in Java, set finals in the initializer:
> 
>     static final int aClass.aField = 0;

I know.  But I would like to write the case that the assigned value is
too complex to write a single statement:

class aClass{}

aspect AnAspect {
    final static List aClass.aField;
    after() : staticitinialization(aClass) {
        List list = new ArrayList();
	list.add(new Integer(1));
	list.add(new Integer(5));
        aClass.aField = Collections.unmodifiableList(list);
    }
}


> Susumu YAMAZAKI wrote:
> > Dear all,
> > 
> > I would like to assign a value to a final (static) field on inter-type
> > declaration in static initializer as follows, but AspectJ does not
> > allow this:
> > 
> > aspect AnAspect {
> >     static class aClass {}
> >     final static int aClass.aField;
> >     after() : staticinitialization(aClass) {
> >         aClass.aField = 0;
> >     }
> > }
> > 
> > any ideas?
> > 
> > Thanks,
> > 
> > Susumu YAMAZAKI <yamazaki@xxxxxxxxxxxxxxx>
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users

Susumu YAMAZAKI <yamazaki@xxxxxxxxxxxxxxx>


Back to the top