Emond Papegaaij commented on Bug WELD-1600

It's proving to be very difficult to come up with a small testcase. Perhaps you can see what's happing with this jboss-marshalling trace:

Caused by: an exception which occurred:
	in object of type org.jboss.weld.annotated.slim.backed.BackedAnnotatedField$SerializationProxy
	in field field
	in object of type org.jboss.weld.injection.attributes.InferringFieldInjectionPointAttributes
	in field attributes
	in object of type org.jboss.weld.injection.FieldInjectionPoint
	in field injectionPoint
	in object of type org.jboss.weld.bean.builtin.InstanceImpl$SerializationProxy
	in field instance
	in object of type org.jboss.weld.context.SerializableContextualInstanceImpl
	in element at index [0] of size [1]
	in field c
	in object of type java.util.Collections$SynchronizedList
	in field dependentInstances
	in object of type org.jboss.weld.context.CreationalContextImpl
	in field parentCreationalContext
	in object of type org.jboss.weld.context.CreationalContextImpl
	in field creationalContext
	in object of type org.jboss.weld.bean.builtin.InstanceImpl$SerializationProxy
	in field restClient
	in object of type nl.topicus.cobra.restclient.RestDataProviderImpl
	in field dataProvider
	in object of type nl.topicus.eduario.web.components.datapanel.EduArioDataPanel
	in element at index [0] of size [5]
	in field children
	in object of type nl.topicus.eduario.web.pages.agenda.AgendaPage
	in element at index [0] of size [1]
	in object of type org.apache.wicket.page.PageStoreManager$SessionEntry
	in map value at index [7] of size [11]

The bottom part is easy to explain: the session contains a PageStoreManager with an AgendaPage, which contains a DataPanel, which uses a RestDataProviderImp to fetch its data. RestDataProviderImp injects RestClients using the following declaration:

@Inject
private Instance<RestDataProviderClient< ? , ? >> restClient;

This is where I do not understand what's happening anymore. The Instance is serialized as an InstanceImpl$SerializationProxy, which has a creationalContext with a parentCreationalContext with the following dependentInstances:

[Bean: ForwardingBean null for Implicit Bean [javax.enterprise.inject.Instance] with qualifiers [@Default]; Instance: @Default Instance<RestDataProviderClient<Object, Object>>; CreationalContext: org.jboss.weld.context.CreationalContextImpl@63b4a35b]

This SerializableContextualInstanceImpl has an 'instance' field which is the Instance we started with (the restClient field). Deserialization now continues with the 'injectionPoint' field, which refers to the RestDataProviderImp type, which is not yet known, causing the NPE.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira