Hi Sina, That should work, the use of 'privileged' should cause generation of an accessor method that can then be used by the aspect.
here is my sample: ==== 8< ==== Parent.java package com.somewhereelse; public class Parent { protected void foo() { System.out.println("foo!"); } } ===== 8< ==== ===== 8< ==== Child.java package com; import com.somewhereelse.Parent; public class Child extends Parent { public static void main(String[] args) { new Child().m(); } public void m() { } } ===== 8< ==== Overthere.aj package xxx; import com.Child; privileged aspect Overthere { before(Child c): execution(* Child.m(..)) && this(c) { c.foo(); } } ===== 8< ==== > ajc -1.5 com/Child.java com/somewhereelse/Parent.java xxx/Overthere.aj > -showWeaveInfo -d output Join point 'method-execution(void com.Child.m())' in Type 'com.Child' (Child.java:11) advised by before advice from 'xxx.Overthere' (Overthere.aj:6) > cd output > java com.Child foo! Here is the accessor in the Parent class: > javap com.somewhereelse.Parent Compiled from "Parent.java" public class com.somewhereelse.Parent extends java.lang.Object{ public com.somewhereelse.Parent(); protected void foo(); public void ajc$privMethod$xxx_Overthere$com_somewhereelse_Parent$foo(); } So what is different about your configuration from mine? cheers, Andy On 21 May 2012 09:25, Sina <my.linked.acco...@googlemail.com> wrote: > Hi there. > > I have Parent class and a child one. The parent class has > some protected methods. > My pointcut works on methods of the child class. The problem is that I want > to access protected methods of the parent in my Aspect, but they are not > visible from within my Aspect. > > All these 3 classes (Parent, Child, Aspect) are in different packages. > > I read here http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg03270.html > that using privileged modifier will solve the problem but it does not work > for me. > Any idea?? > > Sina > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > _______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users