dev@javaserverfaces.java.net

Re: Please help: CDI definition failure:WELD-000409: Observer method for container lifecycle event

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Tue, 15 Sep 2015 00:08:17 +0200

Hi,

On Tue, Sep 15, 2015 at 12:03 AM, arjan tijms <arjan.tijms_at_gmail.com> wrote:
> But would be great if you could wait a little with this commit until
> the commit for 1391 has been done.

Okay, the commit for 1391 has been done, if you want the below change
for the lambda can be committed.

Kind regards,
Arjan Tijms


>>
>>
>> --
>> | edward.burns_at_oracle.com | office: +1 407 458 0017
>> | 38 Business days til JavaOne 2015
>> | 53 Business days til DOAG 2015
>>
>> Don't use lambda in processBean() since Weld doesn't like it.
>>
>> SECTION: Modified Files
>> ----------------------------
>> M jsf-ri/src/main/java/com/sun/faces/cdi/CdiExtension.java
>>
>>
>> SECTION: Diffs
>> ----------------------------
>> Index: jsf-ri/src/main/java/com/sun/faces/cdi/CdiExtension.java
>> ===================================================================
>> --- jsf-ri/src/main/java/com/sun/faces/cdi/CdiExtension.java (revision 15195)
>> +++ jsf-ri/src/main/java/com/sun/faces/cdi/CdiExtension.java (working copy)
>> @@ -47,6 +47,7 @@
>> import java.util.LinkedHashMap;
>> import java.util.List;
>> import java.util.Map;
>> +import java.util.Optional;
>>
>> import javax.enterprise.event.Observes;
>> import javax.enterprise.inject.spi.AfterBeanDiscovery;
>> @@ -105,17 +106,13 @@
>> @SuppressWarnings("unchecked")
>> public <T extends DataModel<?>> void processBean(@Observes ProcessBean<T> event, BeanManager beanManager) {
>>
>> - // Collect all classes annotated by @FacesDataModel in a Map
>> - // Key: (collection) class that a DataModel implementations wraps
>> - // Value: the DataModel implementation class
>> -
>> - getAnnotation(beanManager, event.getAnnotated(), FacesDataModel.class)
>> - .ifPresent(d ->
>> - forClassToDataModelClass.put(
>> - d.forClass(),
>> - (Class<? extends DataModel<?>>) event.getBean().getBeanClass()
>> - )
>> - );
>> + Optional result;
>> + result = getAnnotation(beanManager, event.getAnnotated(), FacesDataModel.class);
>> + if (null != result && result.isPresent()) {
>> + FacesDataModel d = (FacesDataModel) result.get();
>> + forClassToDataModelClass.put(d.forClass(),
>> + (Class<? extends DataModel<?>>) event.getBean().getBeanClass());
>> + }
>> }
>>
>> /**
>>
>>
>>