Description
Firing Arrays.asList(1, 4, 9, 16) as an event of type List<Integer> results in a stack overflow:
javax.enterprise.event.ObserverException: Caught Exception while handling event object with type : java.lang.Object at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:641) at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:481) at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:466) at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:456) at org.apache.webbeans.lifecycle.StandaloneLifeCycle.afterStartApplication(StandaloneLifeCycle.java:62) at org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication(AbstractLifeCycle.java:141) at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:104) at org.apache.deltaspike.cdise.owb.OpenWebBeansContainerControl.boot(OpenWebBeansContainerControl.java:68) at demo.LifecycleEventTest.shouldNotFireInitializedTwice(LifecycleEventTest.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: org.apache.webbeans.exception.WebBeansException: java.lang.reflect.InvocationTargetException at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:314) at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:610) ... 31 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:343) at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:308) ... 32 more Caused by: java.lang.StackOverflowError at java.lang.Class.getInterfaces(Class.java:845) at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1000) at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011) at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011) at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011) at org.apache.webbeans.util.GenericsUtil.getDirectSubclass(GenericsUtil.java:1011)
To reproduce, take the test case attached to OWB-1065 and uncomment a line in the Sender class:
public void onInitialized(@Observes @Initialized(ApplicationScoped.class) Object object) { List<Integer> list = new ArrayList<>(Arrays.asList(1, 4, 9, 16)); list = Arrays.asList(1, 4, 9, 16); event.fire(list); }