Skip to main content

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

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. ;-)

>> 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).

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

>  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



Back to the top