Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] final field access?

Title: RE: [aspectj-users] final field access?

Cheers Nicholas, I missed that in the docs.

So, my fields have to be non final.  I'm cool with that.  Is there anyway to make them final using an aspect?  Let me explain.  I have a range of currently final fields that I want to override because of a temporary hack that has to be put in place.  The override is fine and working, it just overrides the get call.  But I also want to make sure noone forgets and tries to write to them.  So I was trying to accomplish something like:

        declare error
                : set(public static String DistributionInvestmentPlanBindingQueries.*)
                : "Don't do that.  See Adam for more details.";

However this stops me being able to assign to them initially.  Is it possible to structure a pointcut so that it binds to all but the initial assignment?

Cheers
Adam


-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of Nicholas Lesiecki
Sent: Thursday, 21 April 2005 2:12 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] final field access?


final fields are inlined by the compiler. I believe this limitation is
documented in the AspectJ Programming Guide.

Standard disclaimer:
apologies for the terseness of this email, I'm typing with a broken
wrist.

Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming
m: 650 793-5734

Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Articles on AspectJ:
* AOP@Work Series: http://tinyurl.com/3s3pk,
* Intro: http://tinyurl.com/66vu
On Apr 20, 2005, at 9:09 PM, Adam Jenkins wrote:

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


Standard disclaimer:
apologies for the terseness of this email, I'm typing with a broken
wrist.

Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming
m: 650 793-5734

Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Articles on AspectJ:
* AOP@Work Series: http://tinyurl.com/3s3pk,
* Intro: http://tinyurl.com/66vu

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

Important notice: This message is intended for the individual(s) and entity(s) addressed. The information contained in this transmission and any attached, may be confidential and may also be the subject of legal privilege, public interest immunity or legal professional privilege. Any review, retransmission, dissemination or other use of, taking of any action in reliance upon this information by person or entities other than the recipient is prohibited and requires authorization from the sender. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person) you may not copy or deliver this message to anyone. In such cases you should destroy this message and kindly notify the sender by reply email.

WARNING: Although Infocomp has taken reasonable precautions so that no viruses are present in this e-mail, the company cannot accept responsibility for any loss or damage arising from the use of e-mail attachments.


Back to the top