Currently if I have following observer:
void observesApple(@Observes Pear apple)
|
and I try to change it within POM as follows:
void observesPearPOM(@Observes ProcessObserverMethod<Pear, FirstFruitObserver> event) {
|
// set observed type to Apple
|
event.configureObserverMethod().observedType(Apple.class);
|
}
|
I will get following exception:
java.lang.IllegalArgumentException: argument type mismatch
|
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.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:96)
|
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:86)
|
at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129)
|
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:344)
|
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:322)
|
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:300)
|
at org.jboss.weld.bootstrap.events.builder.ObserverMethodConfiguratorImpl.lambda$read$47(ObserverMethodConfiguratorImpl.java:146)
|
at org.jboss.weld.bootstrap.events.builder.ObserverMethodBuilderImpl$NotificationCallback.notify(ObserverMethodBuilderImpl.java:170)
|
at org.jboss.weld.bootstrap.events.builder.ObserverMethodBuilderImpl$ImmutableObserverMethod.notify(ObserverMethodBuilderImpl.java:142)
|
at org.jboss.weld.util.Observers.notify(Observers.java:138)
|
at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:300)
|
at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:288)
|
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:165)
|
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:147)
|
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:623)
|
at org.jboss.weld.util.ForwardingBeanManager.fireEvent(ForwardingBeanManager.java:101)
|
This is likely expected but I think we should improve expcetion message to be more clear.
|