Hello, I would like to use a privileged access and weave it at load-time. I did not see anywhere that it was not possible to do so. On the other hand, I could only make it work with compile-time weaving so far. Could you please help me to make it work (or just tell me it is not possible)?
I was playing with this mock project: https://stackoverflow.com/questions/10721037/aspectj-access-private-fields Code excerpt: public class ClassWithPrivate { private String s = "myStr"; } ========== package com.example.aspect; import com.example.ClassWithPrivate; privileged public aspect AccessPrivate { public String ClassWithPrivate.getS() { return this.s; } public void ClassWithPrivate.setS(String str) { this.s = str; } } ========== package com.example; public class TestPrivate { public static void main(String[] args) { ClassWithPrivate test = new ClassWithPrivate(); System.out.println(test.getS()); test.setS("hello"); System.out.println(test.getS()); } } I installed ADT to eclipse and now I can see the aspect weaved into the bytecode. I saw this when I decompiled the code: public class ClassWithPrivate { public void setS(String paramString) { AccessPrivate.ajc$interMethod$com_example_aspect_AccessPrivate$com_example_ClassWithPrivate$setS(this, paramString); } public String getS() { return AccessPrivate.ajc$interMethod$com_example_aspect_AccessPrivate$com_example_ClassWithPrivate$getS(this); } private String s = "mystr"; } So here is the question: Is it possible to do it with load-time weaving? I disabled ADT, then I added the aspect to the aop.xml as I normally do. However, the class that tried to access the privileged methods, that gave a compile error. Thanks, Tamas
_______________________________________________ aspectj-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/aspectj-users
