[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] Weaving into Java System Libs
|
- From: Andrew Eisenberg <andrew@xxxxxxxxxxxx>
- Date: Thu, 30 Jul 2009 07:59:32 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=UuSG3mHKp0WEE5ff1Ug3RAtjjKAvVwcPZkpmq0Moss4=; b=FmVT7GjK7j3chG/1uJVEeynBDQQn6tWi1dSIzpFf2lRbcyiDdvOoRFsOjLMtx1IU0P F3Zpci/Hgd2oGlT1x29GiFYAKJWDBVFB56FfYZxl9bAvppRLxf9ExJ8aAkrn+lCWxlZw 7WM00LF4VMUJPsQ3Q0WhjYl6oozQUYjkaH0pQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=mQknBRbzPYvaP6fdseDW9YD/wxzggqiAK+ek4zpkWQF9LL42cWjG01S3FPVMG9iQBu W/wK8tayfmmIBCc5naVOMuS7hkmzm3NPdz5xoQ86iLFntvPPlRvS+u6A2T6YIQZQyoIx buJRNv4yY6WEe2a1gteySAi0Xa4Ah7IkbgtSE=
Have you tried using after returning advice? That should be able to
capture the result of a 'new' call.
On Thu, Jul 30, 2009 at 4:20 AM, Nikolas
Nehmer<nnehmer@xxxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> 1st problem solved. There was a little error in the pointcut! Sorry for
> that.
>
> But there still is an open question. Why is the thisJoinPoint.getTarget in
> the following example always null? And yes, I double checked...it's not only
> the toString() method that delivers null results ;-)
>
> pointcut init() : call(new()) && !within(TestAspect) && !within(setup..*);
> after(): init() {
> System.out.println(thisJoinPoint.getTarget());
> }
> Cheers,
> Nikolas
>
> Nikolas Nehmer schrieb:
>>
>> Hi,
>>
>> I'm wondering if it is possible to monitor every constructor call in my
>> application e.g. including calls to java.lang.*. In my understanding, this
>> would only imply weaving code into "my" application and not into java system
>> libs.
>>
>> But if I use something like:
>> pointcut init() : call(new())...;
>> constructor calls within myApp are aspectized but constructor calls to
>> system libs are not. I understand that an initialization advice only works
>> in myApp but using call-advice should also work for system lib calls? Am I
>> wrong?
>>
>> Best Nikolas
>>
>> Alex Villazon schrieb:
>>>
>>> Hi,
>>> In fact ajc does not restrict weaving into the class library, but the
>>> resulting code may break the VM bootstrapping or crash the VM...
>>>
>>> For LTW, you could implement your own weaving agent using the
>>> WeavingAdaptor, and use
>>>
>>>
>>> bcelWorld.performExtraConfiguration("weaveJavaPackages=true,weaveJavaxPackages=true");
>>>
>>> However, this solution does not apply if you need to weave classes loaded
>>> during VM bootstrapping.... and before the agent starts instrumentation.
>>>
>>> Be aware that you could easily have problems of infinite recursions if
>>> your advices use woven classes of the Java class library.
>>>
>>> These problems are discussed in pdf
>>> <http://www.inf.unisi.ch/projects/ferrari/Publications_files/pppj08.pdf>
>>>
>>> Hope that helps.
>>>
>>> Cheers,
>>>
>>> Alex
>>>
>>>
>>> On Jul 27, 2009, at 11:58 AM, Nikolas Nehmer wrote:
>>>
>>>> Even LTW seems to stop at the boundary to the java system libs. How
>>>> exactly did you solve that problem?
>>>>
>>>> cheers Nikolas
>>>>
>>>> FraGMenT schrieb:
>>>>>
>>>>> As far as I know you are looking for the Load-Time Weaving. I had more
>>>>> or less the same problem and solved it with LTW. I'm afraid you cannot
>>>>> weave system libraries at compile time.
>>>>>
>>>>> Hope this helped you.
>>>>>
>>>>> 2009/7/22 Nikolas Nehmer <nnehmer@xxxxxxxxxxxxxxxxxxxx
>>>>> <mailto:nnehmer@xxxxxxxxxxxxxxxxxxxx>
>>>>> <mailto:nnehmer@xxxxxxxxxxxxxxxxxxxx>>
>>>>>
>>>>> Hi there,
>>>>>
>>>>> I'm new to AOP and AspectJ in particular. Today I started
>>>>> exploring some simple HelloWorld style example aspects. As far as
>>>>> I can tell, everything seems to work smoothly. But currently I
>>>>> have one issue. Is there any chance of weaving bytecode into the
>>>>> java systems libraries (e.g. java.lang.System,…) by “exploiting”
>>>>> AspectJ? I’m trying to circumvent writing my own bytecode
>>>>> instrumentation component. Any ideas?
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Nick
>>>>>
>>>>> _______________________________________________
>>>>> aspectj-users mailing list
>>>>> aspectj-users@xxxxxxxxxxx <mailto:aspectj-users@xxxxxxxxxxx>
>>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> aspectj-users mailing list
>>>>> aspectj-users@xxxxxxxxxxx <mailto:aspectj-users@xxxxxxxxxxx>
>>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>>>
>>>>
>>>>
>>>> --
>>>> Dipl.-Inf. Nikolas Nehmer,
>>>> Dept. of Computer Science. University of Kaiserslautern
>>>> P.O. Box 3049, 67653 Kaiserslautern, Germany.
>>>> room 36/308, phone: +49 (0) 631 - 205 2644, fax: +49 (0) 631 - 205 3299
>>>> mail: nnehmer@xxxxxxxxxxxxxxxxxxxx <mailto:nnehmer@xxxxxxxxxxxxxxxxxxxx>
>>>>
>>>> _______________________________________________
>>>> aspectj-users mailing list
>>>> aspectj-users@xxxxxxxxxxx <mailto:aspectj-users@xxxxxxxxxxx>
>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>
>>
>
>
> --
> Dipl.-Inf. Nikolas Nehmer,
> Dept. of Computer Science. University of Kaiserslautern P.O. Box 3049, 67653
> Kaiserslautern, Germany.
> room 36/308, phone: +49 (0) 631 - 205 2644, fax: +49 (0) 631 - 205 3299
> mail: nnehmer@xxxxxxxxxxxxxxxxxxxx
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>