Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] @Around and final classes

I've been experimenting with using AspectJ and have found what looks like a bug/feature when using it in combo with blueprint ( the DI framework within OSGi).

In short the class that is being advised works fine when the advice class uses the @Before and @After annotations. However if I replace them with an @Around advice I get the following exception on startup;

[2/22/11 16:19:41:347 GMT] 00000016 BlueprintCont E org.apache.aries.blueprint.container.BlueprintContainerImpl doRun Unable to start blueprint container for bundle proc-gateway
60891                                  org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to proxy bean for interceptors: org.apache.aries.blueprint.proxy.FinalModifierException
60892         at org.apache.aries.blueprint.proxy.AsmInterceptorWrapper.createProxyObject(AsmInterceptorWrapper.java:148)
60893         at org.apache.aries.blueprint.container.BeanRecipe.addInterceptors(BeanRecipe.java:651)
60894         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:697)
60895         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
60896         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)
60897         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)
60898         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:624)
60899         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:315)
60900         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:213)
60901         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:453)
60902         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:315)
60903         at java.util.concurrent.FutureTask.run(FutureTask.java:150)
60904         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
60905         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
60906         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
60907         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
60908         at java.lang.Thread.run(Thread.java:736)

Clearly the exception is from the Blueprint container - which doesnt like final classes as its cant create a proxy for them, but I suspect its actually the interplay of the @Around and blueprint thats the issue. 

So my Q is this;

Whats actually happening with the @Around that doesnt happen with the @Before & @After? 
Is the @Around making a new class (possibly final) and thats throwing off the blueprint proxy?

Any help appreciated.

-s

Back to the top