How to weave JDK classes with AspectJ

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to weave JDK classes with AspectJ

Alexander Kriegisch-2
Hi community.

I have been asked so many times how to do this. Usually I just answer
that
  ** I have done it a few times in the past,
  ** it is an advanced topic and not suited for beginners,
  ** JDK weaving is rarely necessary (or makes any sense at all) and can
     usually be avoided by changing your application or aspect design,
  ** you should try to avoid it whenever possible.

On the other hand, it is a nifty little exercise if you just want to
know how far you can go and how powerful AspectJ really is. Under some
circumstances it might even be justified to actually do it.

So for what it is worth, instead of explaining myself over and over
again when being asked on StackOverflow or elsewhere, I have just
created a little demo Maven project on GitHub for you if you should
really decide to tread that troubled track (quoting Amy Winehouse, the
well-known software developer):

https://github.com/kriegaex/SO_AJ_MavenWeaveJDK

Use at your own risk! ;-)

Best regards
--
Alexander Kriegisch
https://scrum-master.de
_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|

Re: How to weave JDK classes with AspectJ

Alexander Kriegisch-2
Hi Andy.

Especially for you I added this remark:
https://github.com/kriegaex/SO_AJ_MavenWeaveJDK#possible-improvements

;-)
--
Alexander Kriegisch
https://scrum-master.de


Alexander Kriegisch schrieb am 22.03.2017 16:04:

> Hi community.
>
> I have been asked so many times how to do this. Usually I just answer
> that
>  ** I have done it a few times in the past,
>  ** it is an advanced topic and not suited for beginners,
>  ** JDK weaving is rarely necessary (or makes any sense at all) and can
>     usually be avoided by changing your application or aspect design,
>  ** you should try to avoid it whenever possible.
>
> On the other hand, it is a nifty little exercise if you just want to
> know how far you can go and how powerful AspectJ really is. Under some
> circumstances it might even be justified to actually do it.
>
> So for what it is worth, instead of explaining myself over and over
> again when being asked on StackOverflow or elsewhere, I have just
> created a little demo Maven project on GitHub for you if you should
> really decide to tread that troubled track (quoting Amy Winehouse, the
> well-known software developer):
>
> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK
>
> Use at your own risk! ;-)
>
> Best regards

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|

Re: How to weave JDK classes with AspectJ

Andy Clement
I see it :) Thanks for pulling this resource together that I can point people at.

cheers
Andy


> On Mar 22, 2017, at 8:17 AM, Alexander Kriegisch <[hidden email]> wrote:
>
> Hi Andy.
>
> Especially for you I added this remark:
> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK#possible-improvements
>
> ;-)
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Alexander Kriegisch schrieb am 22.03.2017 16:04:
>
>> Hi community.
>>
>> I have been asked so many times how to do this. Usually I just answer
>> that
>> ** I have done it a few times in the past,
>> ** it is an advanced topic and not suited for beginners,
>> ** JDK weaving is rarely necessary (or makes any sense at all) and can
>>    usually be avoided by changing your application or aspect design,
>> ** you should try to avoid it whenever possible.
>>
>> On the other hand, it is a nifty little exercise if you just want to
>> know how far you can go and how powerful AspectJ really is. Under some
>> circumstances it might even be justified to actually do it.
>>
>> So for what it is worth, instead of explaining myself over and over
>> again when being asked on StackOverflow or elsewhere, I have just
>> created a little demo Maven project on GitHub for you if you should
>> really decide to tread that troubled track (quoting Amy Winehouse, the
>> well-known software developer):
>>
>> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK
>>
>> Use at your own risk! ;-)
>>
>> Best regards
>
> _______________________________________________
> aspectj-users mailing list
> [hidden email]
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|

Re: How to weave JDK classes with AspectJ

Alexander Kriegisch-2
And any thoughts about the suggested compiler option? I remember it was discussed here or on Bugzilla before. It does not seem hard to implement, but I could be wrong.
--
Alexander Kriegisch
https://scrum-master.de


Andy Clement schrieb am 22.03.2017 17:07:

> I see it :) Thanks for pulling this resource together that I can point
> people at.
>
>
> On Mar 22, 2017, at 8:17 AM, Alexander Kriegisch
> <[hidden email]> wrote:
>
>> Hi Andy.
>>
>> Especially for you I added this remark:
>> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK#possible-improvements
>>
>> ;-)
>>
>>
>> Alexander Kriegisch schrieb am 22.03.2017 16:04:
>>
>>> Hi community.
>>>
>>> I have been asked so many times how to do this. Usually I just
>>> answer that
>>>   ** I have done it a few times in the past,
>>>   ** it is an advanced topic and not suited for beginners,
>>>   ** JDK weaving is rarely necessary (or makes any sense at all) and
>>>      can usually be avoided by changing your application or aspect
>>>      design,
>>>   ** you should try to avoid it whenever possible.
>>>
>>> On the other hand, it is a nifty little exercise if you just want to
>>> know how far you can go and how powerful AspectJ really is. Under
>>> some circumstances it might even be justified to actually do it.
>>>
>>> So for what it is worth, instead of explaining myself over and over
>>> again when being asked on StackOverflow or elsewhere, I have just
>>> created a little demo Maven project on GitHub for you if you should
>>> really decide to tread that troubled track (quoting Amy Winehouse,
>>> the well-known software developer):
>>>
>>> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK
>>>
>>> Use at your own risk! ;-)

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|

Re: How to weave JDK classes with AspectJ

Andy Clement
I don't think it is so hard to implement, no. It has come up a few times in the past.

cheers,
Andy

On 22 March 2017 at 09:28, Alexander Kriegisch <[hidden email]> wrote:
And any thoughts about the suggested compiler option? I remember it was discussed here or on Bugzilla before. It does not seem hard to implement, but I could be wrong.
--
Alexander Kriegisch
https://scrum-master.de


Andy Clement schrieb am <a href="tel:22.03.2017%2017" value="+12203201717">22.03.2017 17:07:

> I see it :) Thanks for pulling this resource together that I can point
> people at.
>
>
> On Mar 22, 2017, at 8:17 AM, Alexander Kriegisch
> <[hidden email]> wrote:
>
>> Hi Andy.
>>
>> Especially for you I added this remark:
>> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK#possible-improvements
>>
>> ;-)
>>
>>
>> Alexander Kriegisch schrieb am <a href="tel:22.03.2017%2016" value="+12203201716">22.03.2017 16:04:
>>
>>> Hi community.
>>>
>>> I have been asked so many times how to do this. Usually I just
>>> answer that
>>>   ** I have done it a few times in the past,
>>>   ** it is an advanced topic and not suited for beginners,
>>>   ** JDK weaving is rarely necessary (or makes any sense at all) and
>>>      can usually be avoided by changing your application or aspect
>>>      design,
>>>   ** you should try to avoid it whenever possible.
>>>
>>> On the other hand, it is a nifty little exercise if you just want to
>>> know how far you can go and how powerful AspectJ really is. Under
>>> some circumstances it might even be justified to actually do it.
>>>
>>> So for what it is worth, instead of explaining myself over and over
>>> again when being asked on StackOverflow or elsewhere, I have just
>>> created a little demo Maven project on GitHub for you if you should
>>> really decide to tread that troubled track (quoting Amy Winehouse,
>>> the well-known software developer):
>>>
>>> https://github.com/kriegaex/SO_AJ_MavenWeaveJDK
>>>
>>> Use at your own risk! ;-)

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|

Re: How to weave JDK classes with AspectJ

Alexander Kriegisch-2
That is good news. But I know you must be mainly busy with AspectJ 1.9 and Java 9 support.

How about a catchy name like "skinny aspect JARs"? I think they would be pretty useful in binary weaving scenarios, also via LTW when overlaying original JARs with some aspect-enhanced versions of (parts of) them. No need to answer, I was just thinking aloud.
--
Alexander Kriegisch
https://scrum-master.de


Andy Clement schrieb am 22.03.2017 19:20:

> I don't think it is so hard to implement, no. It has come up a few times
> in the past.
>
>
> On 22 March 2017 at 09:28, Alexander Kriegisch <[hidden email]
> <mailto:[hidden email]> > wrote:
>> And any thoughts about the suggested compiler option? I remember it was
>> discussed here or on Bugzilla before. It does not seem hard to implement,
>> but I could be wrong.
>>
>>
>> Andy Clement schrieb am 22.03.2017 17 <tel:22.03.2017%2017> :07:
>>
>> > I see it :) Thanks for pulling this resource together that I can point
>> > people at.
>> >
>> >
>> > On Mar 22, 2017, at 8:17 AM, Alexander Kriegisch
>> > <[hidden email]> wrote:
>> >
>> >> Especially for you I added this remark:
>> >> https://github.com/kriegaex/
>> <https://github.com/kriegaex/SO_AJ_MavenWeaveJDK#possible-improvements>
>> SO_AJ_MavenWeaveJDK#possible-improvements
>> >>
>> >>
>> >> Alexander Kriegisch schrieb am 22.03.2017 16 <tel:22.03.2017%2016>
>> :04:
>> >>
>> >>> Hi community.
>> >>>
>> >>> I have been asked so many times how to do this. Usually I just
>> >>> answer that
>> >>> ** I have done it a few times in the past,
>> >>> ** it is an advanced topic and not suited for beginners,
>> >>> ** JDK weaving is rarely necessary (or makes any sense at all) and
>> >>> can usually be avoided by changing your application or aspect
>> >>> design,
>> >>> ** you should try to avoid it whenever possible.
>> >>>
>> >>> On the other hand, it is a nifty little exercise if you just want to
>> >>> know how far you can go and how powerful AspectJ really is. Under
>> >>> some circumstances it might even be justified to actually do it.
>> >>>
>> >>> So for what it is worth, instead of explaining myself over and over
>> >>> again when being asked on StackOverflow or elsewhere, I have just
>> >>> created a little demo Maven project on GitHub for you if you should
>> >>> really decide to tread that troubled track (quoting Amy Winehouse,
>> >>> the well-known software developer):
>> >>>
>> >>> https://github.com/kriegaex/
>> <https://github.com/kriegaex/SO_AJ_MavenWeaveJDK>
>> SO_AJ_MavenWeaveJDK
>> >>>
>> >>> Use at your own risk! ;-)

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users