[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: 回复: Re: [aspectj-users] method <clinit>code size too big problem when weaving

Ok, in this case I think there is no easy workaround and you should
file a bug report.

Eric

On 15/01/2008, Chenghao Situ <situchenghao@xxxxxxxxxxxx> wrote:
> Hi,
>
> Sorry, I mean 3200 joinpoint shadows.
> So you mean JoinPointStaticParts will generate static initial method, right?
> I checked my aspect and found I'm using
> thisJoinPoint.getSourceLocation().getLine();
> in the code. I compare the recompiled weavened code between before and after
> commenting this code, and confirm that this code will generate static
> initial method.Then I checked the API doc, I guess it should actually using
> JoinPointStaticParts, which cause the error.
>
> But the problem is I really need to use getLine() method.Because the code
> I'm weavening is like:
> SomeInterface ImplementClassName;
> public method{
>  ImplementClassName.get(args);
> }
> The ImplementClass is name of a very complex class ImplementClass and in my
> context it is null, now I want to get "ImplementClassName". What I'm doing
> now is to get "ImplementClassName.get(args);" in the sourcecode by using
> getLine() then get "ImplementClassName".In my program, what will returned is
> decided by ImplementClassName and args, but I can only get SomeInterface
> information using ApsectJ Runtime API.
>
> Is there some substitutionary method to implement this function?
> Thank you very much.
>
> Eric Bodden <eric.bodden@xxxxxxxxxxxxxx> 写道:
> You mean you have 3200 pieces of advice? Or 3200 joinpoint shadows? In
> the former case, your code is wrong, I suppose, and in the latter
> case, it seems strange that 3200 JoinPointStaticParts are being
> created.
>
> Eric
>
> On 14/01/2008, 司徒诚颢 wrote:
> > Hi,
> >
> > When my aspectj is weaving to a class which has 3200 advises, eclipse
> > reporting Error "problem generating method packageXX.ClassXX. : Code
>
> > size too big: 78716".
> > I know this is caused by the limitation of the length of java method can
> not
> > longer than 64kb.
> > I modify this class and reduce the number of advises to only 3 and
> recompile
> > it, and find it will generate a static initial method like below:
> > static
> > {
> > Factory factory = new Factory("StubClass.java",
> > Class.forName("StubClass"));
> > ajc$tjp_0 = factory.makeSJP("method-call",
> > factory.makeMethodSig("1", "get", "pachageX.ClassX", "java.lang.String:",
> > "string:", "", "java.lang.String"), 13);
> > ajc$tjp_1 = factory.makeSJP("method-call",
> > factory.makeMethodSig("1", "get", "pachageX.ClassX", "java.lang.String:",
> > "string:", "", "java.lang.String"), 15);
> > ajc$tjp_2 = factory.makeSJP("method-call",
> > factory.makeMethodSig("1", "get", "pachageX.ClassX", "java.lang.String:",
> > "string:", "", "java.lang.String"), 18);
> > }
> > That means if there are 3200 advises, there will be 3200 statements in the
> > static initial method, which may cause the error.
> > And below is my around method:
> > Object around(String var) : aroundGet(var)
> > {
> > //proceed(value);
> > String key = var;
> > int line = thisJoinPoint.getSourceLocation().getLine();
> > Object value = findProperties(line, key);
> > return value;
> > }
> > private Object findProperties(int line, String key)
> > {
> > Object result = null;
> > TestData testData = BaseTestCase.getTestData();
> > result = testData.getValue(line, key);
> > return result;
> > }
> >
> > And another thing is I find that the logic in the around() method will
> > determine the weaved code, if I just return a random number in the
> around(),
> > Aspectj will not generate static initial method, under this scenario, the
> > weaving can success is there are 3200 advises.If I change the around() to
> :
> > Object around(String var) : aroundGet(var)
> > {
> > return new java.util.Random().nextInt(10000);
> > }
> > It will generate code like below:
> > private static final String get_aroundBody4(StubClass stubclass, SomeClass
> > someclass, String s)
> > {
> > return someclass.get(s);
> > }
> > private static final Object
> > get_aroundBody5$advice(AroundGetMethods this, String var,
> > AroundClosure ajc_aroundClosure, AroundGetMethods aroundgetmethods, String
> > s, AroundClosure aroundclosure)
> > {
> > return Integer.valueOf((new Random()).nextInt(10000));
> > }
> >
> > By the way, when I use LTW to weaving this class, aspects generating
> > OutOfMemoryError.
> > But I think if the problem of static way is solved, the LTW should be OK
> > too.
> >
> > So how could I solve this problem? Is there some good suggestions?
> > Thanks for the help.
> >
> > ________________________________
> > 雅虎邮箱传递新年祝福,个性贺卡送亲朋!
> >
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
>
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
> _______________________________________________
> 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
>
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada