Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is it possible to change methods by introducing keywords (like synchronized), adding parameters, or changing the “throws” clause?

0
Posted

Is it possible to change methods by introducing keywords (like synchronized), adding parameters, or changing the “throws” clause?

0

AspectJ does not enable you to change the signature of a method, but you can (by express declaration) work around some limits imposed by the signature. You can convert a checked exception to unchecked using declare soft, privileged aspects have access to private methods, and you can use a percflow aspect to ferry additional state to a callee without changing intervening signatures. For more details, see The AspectJ Programming Guide. In the case of synchronized, we have what we consider a better solution that uses around advice instead of introduction. This solution is described in this thread (no longer available) on the AspectJ users list, with some additional comments (no longer available) .

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.