Thursday, September 03, 2009

It's Not a Feature, It's a Bug

The Flex compiler (mxmlc) has the following feature: It will only include classes in the output swf that are explicitly referenced either within the .mxml files or any explicitly referenced .as files. There is a request for a compiler option to support the inclusion of all classes, but it's still in the works.

The following is one such example where this feature causes difficulties. Suppose I have a Flex client that uses BlazeDS to make an RPC. The RPC returns a Java object that is explicitly mapped to an ActionScript object using [RemoteClass(alias="...")] above the definition of the ActionScript class. This ActionScript class may never be referenced within the Flex code yet is needed to de-serialize the response! The end result is an "Server.Acknowledge.Failed" fault code:

[RPC Fault faultString="Didn't receive an acknowledge message"
faultCode="Server.Acknowledge.Failed" faultDetail="Was expecting
mx.messaging.messages.AcknowledgeMessage, but received null"]