Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] 'checkcast' bytecode instruction following around() insertion

Hi,

There isn't an option to do it, but you could patch the weaver to
experiment out.
Probably need to look in
BcelShadow.weaveAroundInline/weaveAroundClosure where they call
createConversion.

Andy

On 8 December 2011 11:09, Chuck Ritola <cjritola@xxxxxxxxx> wrote:
> Hi list! I am an aspect-J newbie with a quandry/question:
>
> Is there a way to create around() advice such that its return object
> is not cast-checked? I noticed that after around() replaces a method
> call by using an Object return type, for example, SomeClass.new(..) it
> (understandably) adds a checkcast instruction afterward.
>
> What I am trying to do (experimentally) is intercept the
> creation/construction of most types of Objects using pointcuts and
> around(), then instead of passing an object of the original type, use
> my own type of reference object, then guaranteeing to intercept all
> uses of those objects such that they play well with existing method
> calls, etc. for the purpose of distributed computing.
>
> Currently, the checkcast instruction following my around() code
> results in a ClassCastException since my reference classes typically
> aren't a superclass of whatever arbitrary *.new() method my advice
> replaces.
>
> With that in mind, I thought I could try a parent declaration hack:
> i.e. declare parents: MyReference extends *;
> ...but this (and variants) came with their own obvious issues.
>
> Thanks!
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top