Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Progress on privileged support for annotation style aspects...

Hi,

 

Has any progress been made on solving the issues of privileged access to aspects?

 

For example, if I have a class:

public class A {

      private int i;

}

 

and aspect:

 

@Aspect

public class AspectA {

     

      // set i after constructor has returned

@AfterReturning("this(a) && execution(public *.new(..))")

      public void setI( A a ){

            a.i = 42;

      }

}

 

then we will get a ‘not visible’ error for the assignment to i.

 

 

It seems to me that it would be generally useful, outside of AspectJ too, to be able to tell the compiler/editor to allow access to private, protected and package scope objects.

 

This would be done by changing the function to:

 

      public void setI( @PrivilegedAccess(‘private’) A a ){

            a.i = 42;

      }

 

 

In fact, this would probably equate to an annotation-based ‘friend’ capability that C++ boasts of.

 

Naturally, the passing of references would have to be dealt with, but this should be possible.  It may also allow annotations and an APT plugin to be used rather than having to work around security when doing reflection on object graphs, for example.

 

The benefit of standardising something like this is that it would (with agreement with Sun et al) allow a standard compiler to support this.  The consequences, however, may be rather too scary!

 

Cheers,

 

Neale

 

 

**********************************************************************
IMPORTANT NOTICE.
Confidentiality:  This e-mail and its attachments are intended for the above named only and may be confidential.  If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error.
Security Warning:  Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium.
We advise that you understand and observe this lack of security when e-mailing us.
Viruses:  Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.
Monitoring and Scanning:  Cambridge Cognition has monitoring and scanning systems in place in relation to emails sent and received to: monitor / record business communications; prevent and detect crime; investigate the use of the Company's internal and external email system; and provide evidence of compliance with business practices.

Cambridge Cognition Limited
Company Registration Number 4338746
Registered address:
Tunbridge Court
Tunbridge Lane
Bottisham
Cambridge
CB25 9TU
UK
**********************************************************************


Back to the top