PDA

View Full Version : CDI Extension: ProcessAnnotatedType throws StackOverflowError


swiegersf
06-22-2010, 10:16 AM
Good day,

I'm trying to build a CDI portable extension that observes the ProcessAnnotatedType event (as per the CDI spec 11.5.5), using Resin 4.0.7's client container (I believe this should happen in the actual application server too, I haven't tested it there).

However, if I register my extension below:


public class RemoteExtension implements Extension {

public <T> void decorateAnnotatedType(@Observes ProcessAnnotatedType<T> pat) {
}
}


I get:


Exception in thread "main" java.lang.StackOverflowError
at com.caucho.config.reflect.BaseType.create(BaseType .java:141)
at com.caucho.config.reflect.BaseType.toBaseType(Base Type.java:214)
at com.caucho.config.reflect.BaseType.create(BaseType .java:164)
at com.caucho.config.reflect.BaseType.create(BaseType .java:110)
at com.caucho.config.reflect.BaseType.create(BaseType .java:154)
at com.caucho.config.reflect.BaseType.toBaseType(Base Type.java:214)
at com.caucho.config.reflect.BaseType.create(BaseType .java:164)
at com.caucho.config.reflect.BaseType.create(BaseType .java:110)
at com.caucho.config.reflect.BaseType.create(BaseType .java:154)
at com.caucho.config.reflect.BaseType.toBaseType(Base Type.java:214)

ferg
06-25-2010, 05:44 PM
Try using "ProcessAnnotatedType<?>" instead of <T> as a workaround.

The circular call is clearly a Resin bug.

swiegersf
06-28-2010, 09:09 AM
Thanks for the reply, Scott,

Unfortunately the workaround seems to have the exact same problem:


public void onProcessAnnotatedType(@Observes ProcessAnnotatedType<?> pat) {
}



Regards
Francois

swiegersf
06-29-2010, 01:42 PM
I have logged this as a bug: http://bugs.caucho.com/view.php?id=4091