Hi,
I can't seem to see the code in your message below. However, assuming
it is something like this:
====
aspect X {
interface Marker {}
declare parents: Code implements Marker;
String Marker.log = "abc";
}
public class Code {
public static void main(String []argv) {
new Code().bar();
}
public void bar() {
System.out.println(log);
}
}
====
You see it just works if you compile with ajc. (and prints 'abc' when
you run Code). This is because ajc knows that the log reference in
bar refers to the introduced field.
It gets complicated if you want to have user code exploit log and yet
be compiled with javac.
cheers,
Andy
On 7 December 2011 10:04, Mark <[email protected]> wrote:
> Hi.
> I am not sure if my terminology is right, but here is what I want. I have an
> aspect that injects a Log field into certain types, here is the aspect code:
>
>
> The question is how the aspect subjects can make use of this field. For
> instance, here is a sample class affected by this aspect:
>
>
> The question is how the code of getUser can utilize the Log field injected
> by the aspect?
>
> Thanks.
>
> --
> View this message in context:
> http://aspectj.2085585.n4.nabble.com/How-can-I-make-ITD-available-in-the-code-of-the-aspect-subject-tp4169901p4169901.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users