Skip to main content

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

There are other experts on the list who weave rt.jar, hopefully one of
them can chip in on this.

If you absolutely know you only want to weave one class, just extract
it from the jar, weave it and put it back in the original jar.

> If I'm redeploying the whole runtime, I'm missing out on half of it

I don't understand.  Are you not getting all the input classes into
the output jar?  Size is perhaps not something to consider as rt.jar
is specially packed (I believe) to optimize JVM startup time.  That
packing isn't respected when it is repacked by AspectJ (it just
considers it an ordinary jar).

I had imagined you'd be weaving outside of eclipse rather than inside
- I'm not sure how AJDT handles things inside of eclipse for weaving a
special jar like that.  Outside of eclipse it is simply:

ajc -inpath rt.jar -outjar new_rt.jar MyAspect.java

(With appropriate Xmx set in the ajc.bat file)

Andy

2009/10/1 Kajetan Abt <kdansky@xxxxxxxxx>:
> Within() helped significantly with compile time, though my jar is still
> 24MB. On the other hand, the rt.jar is twice as big. Either way, this can't
> be right. If I'm redeploying the whole runtime, I'm missing out on half of
> it (and as expected, I got "java/lang/NoClassDefFoundError:
> java/lang/Object" when I changed my bootclasspath to point into my own
> library folder (where the woven jar is). Is it not possible to only weave
> the one class I want to change but load the others from the jre/rt.jar? Do I
> have to write my own classloader to exchange JComponent?
>
>
> :B:  10:40:50
> ===========================================================================================
> :B:  10:40:50 Build kind = AUTOBUILD
> :B:  10:40:50 Project=TooltipWrangler, kind of build requested=Incremental
> AspectJ compilation
> :B:  10:40:50 Timer event: 0ms: Flush included source file cache
> :B:  10:40:50 Timer event: 1ms: Check delta
> :B:  10:40:50 File: <path>/Wrangler.aj has changed.
> :B:  10:40:50 build: Examined delta - 1 changed, 0 added, and 0 deleted
> source files in required project TooltipWrangler
> :B:  10:40:50 Timer event: 0ms: Looking for and marking configuration
> changes in TooltipWrangler
> :B:  10:40:50     Configuration changes found: true
> :B:  10:40:50 Timer event: 0ms: Look for source/resource changes
> :B:  10:40:50 Setting list of classpath elements with modified contents:
> :B:  10:40:50       []
> :B:  10:40:50 Timer event: 3ms: Pre compile
> :B:  10:40:50 Sending the following configuration changes to the compiler:
> []
> :B:  10:40:50 1 source file changes since last build
> :B:  10:40:50 Compiler configuration for project TooltipWrangler has been
> read by compiler.  Resetting.
> :B:  10:40:50      Configuration was []
> :B:  10:40:50 Resetting list of modified source files.
> :C:  10:40:50 Preparing for build: not going to be incremental because
> outjar being used
> :C:  10:40:50 Falling back to batch compilation
> :C:  10:40:50 Preparing for build: not going to be incremental because no
> successful previous full build
> :C:  10:40:54 Timer event: 4270ms: Time to first compiled message
> :C:  10:40:57 Timer event: 7289ms: Time to first woven message
> :C:  10:40:57 Processing progress message: Can't find eclipse resource for
> file with path woven class
> com.sun.accessibility.internal.resources.accessibility (from
> /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar)
>
> <this is repeated for every single class encountered and takes forever>
>
> :C:  10:40:59 Processing progress message: Can't find eclipse resource for
> file with path woven class java.lang.Object (from
> /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar)
> :C:  10:41:3 AspectJ reports build successful, build was: FULL
> :C:  10:41:3 AJDE Callback: finish. Was full build: true
> :B:  10:41:3 Timer event: 13305ms: Total time spent in AJDE
> :B:  10:41:3 Timer event: 0ms: Refresh after build
> :C:  10:41:3 Types affected during build = 2  //this seems fine to me
> :B:  10:41:3 Timer event: 13310ms: Total time spent in AJBuilder.build()
> :B:  10:41:3 Timer event: 1ms: Delete markers: TooltipWrangler (Finished
> deleting markers for TooltipWrangler)
> :B:  10:41:3 Timer event: 0ms: Create markers: TooltipWrangler (Finished
> creating markers for TooltipWrangler)
> :B:  10:41:3 Created 0 markers in 2 files
> :B:  10:43:49 Timer event: 0ms: Update visualizer, xref, advice listeners
> for (separate thread): TooltipWrangler
>
>
>
>
> 2009/9/30 Andy Clement <andrew.clement@xxxxxxxxx>
>>
>> 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
>> >
>> >
>> _______________________________________________
>> 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
>
>


Back to the top