[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW into javax.swing

Please add a within() clause to your pointcut if you can, to limit the
matching - that will speed things up.

Strange that the jar grows significantly for a simple pointcut like
that.  If you turn on -showWeaveInfo or -verbose, do you see anything
untoward? Anything you don't expect?

If you modify the rt.jar you have to launch the VM specifying a
different bootclasspath so it sees your jar and not the built in jar.
Putting it on the classpath will mean it is seen too late.

Andy

2009/9/30 Kajetan Abt <kdansky@xxxxxxxxx>:
> Ok, I after a detour finally got on this and tried to make it work. You were
> right, I can actually go with compile-time weaving. For those who struggle:
>
> 1. Eclipse needs a lot more RAM if it has to go through rt.jar (located in
> the jre)
> 2. The setting to add -injars is in Properties/AspectJ
> Compiler/Other/non-standard compiler option, something like:
> -injars :/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar
>
> But now I'm a bit irritated by my result: First off, I get a 24 MB jar,
> which is rather big, considering I only weave this:
>
>     before(JComponent component):
>         execution( public String JComponent.getToolTipText(MouseEvent) )
>         && target(component)  {...}
>
> It also spans into strange directories, such as com.sun.corba (do they
> really use swing's tooltips? I doubt it). I assumed I could just add the
> created jar as a library into my project, but that does not have any effect
> (but the non-aspect classes in that jar are visible and usable just fine).
> Any ideas?
>
> Thanks
> Kajetan
>
>
> 2009/9/28 Andy Clement <andrew.clement@xxxxxxxxx>
>>
>> Compile time weaving doesn't mean you have to recompile swing - by
>> 'compile time' I meant the aspects.  At the time you compile the
>> aspects just pass the swing jar in as binary input and ajc will weave
>> the aspects into it, producing a new jar file.  You don't need the
>> source for swing.
>>
>> >From your trace it indicates that no weaver is being created for the
>> classloader that loads the swing classes.  If this doesn't happen then
>> that loader will never weave anything.  The -Xset flags are only
>> useful if the weaver actually gets to see types with that prefix.  I
>> don't know the solution to making the more system'y classloaders
>> associate a weaver instance - maybe someone else on the list does.
>>
>> However, it would be far easier to binary weave the jar containing the
>> swing classes before you launch the app at all.
>>
>> cheers,
>> Andy
>> _______________________________________________
>> aspectj-users mailing list
>> 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
>
>