Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Re: Extending standard java classes


On Dec 2, 2008, at 3:49 PM, Tassilo Horn wrote:

Alex Villazon <alex.villazon@xxxxxxxxxxx> writes:

Hi Alex,

What I want to do is to add an interface to some classes.  From the
documentation I can see how that's done, but unfortunately I want to
add this interface to about 10 classes from java.lang and java.util.

When I did that I got warnings that the affected types aren't exposed
to the weaver.  So I added the JRE System Library to the *inpath*.
But then I don't have enough memory to run the aspectj compiler.

  You could simply edit ajc script and change the -Xmx param (e.g. -
Xmx1G)

I use the eclipse plugin and have -Xmx1G in my eclipse.ini. And that's
not enough. ;-)


 Hi,
I think you should weave the JDK classes offline, and not within eclipse.
   I don't have enough experiences with woven JDK with eclipse...

So is there a way to pick only the 10 classes I need out of the
library?

 One way is to unjar the rt.jar on a directory, and then make your
own jar with the classes you need, and weave them.

I thought that might be a solution. But then I'd need to recreate that
lib whenever I update the JDK and maybe it could lead into problems if
developers use different JDK versions (1.6.0 vs. 1.6.10).


Mmm, I think anyways that you need to build a woven JDK (or part of it) on a per aspect basis...


Well, there are worse things, but when you say "one way" do you imagine
another way, too?


I'm not sure how weaving JDK classes could be combined with eclipse. So far, I only explored that issue without a IDE. I think that you could weave the rt classes offline, and then use the VM params within eclipse to pass them through -Xbootclasspath.. Not sure if this will work out of the box, but I think so..

Alex


Something like
mkdir JDK
cd JDK
jar xvf $JAVA_HOME/jre/lib/rt.jar
jar cvf myrt.jar java/lang/... java/util/...

Then you weave myrt.jar and finally pass the woven myrt.jar to -
Xbootclasspath/p:

I'll try that out anyway.

Thanks a lot,
Tassilo

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top