In response to an earlier post à [aspectj-users]
NoSuchMethod aspectOf exception using LTW.
I have an aspect class which kept
constantly failing with the above NoSuchMethodError. To get around it,
I just added the method it was unable to
find. See below
@Aspect
Class XYZ
{
@Around("execution(* foo.bar(..))")
public Object applyAround(ProceedingJoinPoint jp)
throws Throwable
{
// some code
}
// added this method and things were back
to normal
public static XYZ aspectOf()
{
return new XYZ();
}
// tried this but the method took for
ever to return and finally the application ran out of memory
/*
public static XYZ aspectOf()
{
return Aspects.aspectOf(XYZ.class);
}
*/
}
Not sure if there is a better long term
fix (like a setting in aop.xml). I don’t want to add this method for
every aspect I’m writing nor do I want to use “compile time weaving
(ajc)” for the aspects. Can anyone provide a better solution?
Please Note:
When Mr. Andrew Clement fixed the issue
below, he released a Dev version (please refer to the comments in the bug
report - 1.6.4 Dev) which was working perfectly. None of the later versions out
there seem to work without the hack.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=279298