[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Pointcut for package protected methods

Title: Pointcut for package protected methods

Actually, we (the aspectbench group) have just released the full semantics of static aspectj matching in the form of datalog rules:

 

See those two TRs.

http://abc.comlab.ox.ac.uk/techreports#abc-2006-3

http://abc.comlab.ox.ac.uk/techreports#abc-2006-2

 

You might find that useful.

 

Eric

 

From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Wes
Sent: Tuesday, September 26, 2006 2:36 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Pointcut for package protected methods

 

Hi -

 

(This reply sent 9/21 but apparantly california.com was on a spamcop list.)

 

> Yes, I thought I had tried that and got an error, but it definitely works.

 

Hmm - it doesn't work for me, but execution(!private !public * *(..)) does.

 

Shockingly, none of the syntax references (the AspectJ 5 quickref pdf
the AspectJ quickref pdf, or the AspectJ quick reference in the
programming guide) show the syntax for modifiers, so
https://bugs.eclipse.org/bugs/show_bug.cgi?id=158159

 

I'll put this in
{AspectJ}/doc/aspectjlib/src/org/aspectj/lib/pointcuts/Pointcuts.java

 

Wes
-------------------------- Protecteds
public class Protecteds {
 public void publicMethod() {}
 private void privateMethod() {}
 protected void protectedMethod() {}
 void packageProtectedMethod() {}
 static aspect A {

 

   pointcut methodsProtected() :
       execution(!private !public * *(..));

 

   declare warning : methodsProtected()
       && within(Protecteds)
     : "protected or package protected";        
 }
}

------------Original Message------------

From: "David Hatton (AT/LMI)" <david.hatton@xxxxxxxxxxxx>

To: aspectj-users@xxxxxxxxxxx

Date: Tue, Sep-26-2006 11:23 AM

Subject: RE: [aspectj-users] Pointcut for package protected methods

Actually, this doesn't work ... I originally thought it did, but got a syntax error when I tried it.

 

I've reverted to my original solution unless anyone else has a better mechanism????

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of David Hatton (AT/LMI)
Sent: 21 September 2006 15:50
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Pointcut for package protected methods

Yes, I thought I had tried that and got an error, but it definitely works.

 

thanks for that!!

 

 

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Bodden
Sent: 21 September 2006 15:47
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Pointcut for package protected methods

You can do things like this, I believe:

 

execution((!private && !final && !public) * com.ericsson.nms.cif.cs.transaction.*.*(..))

 

 

Eric

 

From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of David Hatton (AT/LMI)
Sent: Thursday, September 21, 2006 10:34 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Pointcut for package protected methods

 

Hi,

I am trying to define a point but for methods in a particular package which are either protected or package protected (default access).

I can't come up with anything better than this:

    pointcut protectedTxMethods() :
        execution(* com.ericsson.nms.cif.cs.transaction.*.*(..)) &&
        execution(!final * com.ericsson.nms.cif.cs.transaction.*.*(..)) &&
        execution(!private * com.ericsson.nms.cif.cs.transaction.*.*(..));

Is there a better way, or is this the only way to do it???

/David

 

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