Hello!

I'm just wondering, how i could invoke a private method introduced by an 
inter-type declaration via java reflection (method#invoke(...)) using the 
aspectj runtime infrastructure, possibly the AjTypeSystem.

What i want to do is something like this. Suppose i have a class Person, which 
looks like this:

class Person {
   private String name;
}

now i declare an inter-type:

privileged aspect Person_IDT {
   private String Person.getName()  {
       return name;
   }
}

now i would like to do something like this:

Method readMethod = Person.class.getDeclaredMethod("getName");
readMethod.setAccessible(true);
readMethod.invoke(aTarget);

Actually i know, that i won't find the method in this way, because AspectJ 
mangles the name to something beginning with "ajc$interMethodDispatch2$". But 
my hope was, that somewhere in the aspectj runtime, there would be some way to 
achieve something like previously described. Unfortunately i haven't found a 
way.

I would be happy, if you could help me.

best regards,

Thomas


_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to