[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Using the -injar compiler option
|
Hmm... looks like a cycle in the InstructionHandle list:
---- Utility.java
public static int getSourceLine(InstructionHandle ih) {
if (ih == null) return -1;
<snip...>
return getSourceLine(ih.getNext()); // StackOverflow here
}
----
It doesn't seem like this *should* be a side-effect of
decompiling classes also in the parent loader, but...
In any case, it's definitely worth writing up as a bug.
http://dev.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
(Weaving rt.jar seems like a lot of work to isolate test cases;
is there some other way to do it? We don't recommend users
weave Java classes.)
Thanks for bringing this up -
Wes
James Howe wrote:
>
> I'm trying to write some unit tests which invoke code which references some
> Java classes directly. As such, it is hard to use a Mock object
> implementation to allow the test case to run without accessing the real
> Java class. I notice that the AspectJ compiler has an option called
> 'injars' whose description seems to imply that aspects can be woven into
> classes found in the 'injar' files. I figured I would try using ajc on the
> Java rt.jar file to see if I could generate a new version of the jar file
> which had the hooks I needed to support my unit testing. Unfortunately
> things didn't work out and I'm wondering if this is because of a bug, or
> because I'm trying to do something that ajc isn't really designed to
> handle. What I did was the following:
>
> 1. Generate a 'unitTestAspects.jar' file from ajc by compiling my aspect
> and using the -outjar option to put the compiled aspect into a jar.
>
> 2. Ran the ajc compiler as follows:
>
> ajc -injars rt.jar -aspectpath unitTestAspects.jar -outjar rt_aj.jar
>
> After fixing an OutOfMemory error by increasing the memory available to
> ajc, I ran the compiler once again. After a period of time the compiler
> aborted with the following:
>
> java.lang.StackOverflowError
> at org.aspectj.weaver.bcel.Utility.getSourceLine(Utility.java:436)
> at org.aspectj.weaver.bcel.Utility.getSourceLine(Utility.java:436)
> ...
>
> I'm running with AspectJ 1.1rc2 on Windows XP with JDK 1.4.01.
>
> Thanks.
>
> --
> James Howe
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users