Skip to main content

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

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!


Back to the top