apache / apache/royale-asjs

Incorrect Message type cast by compiler.

Open
#1,099 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
ActionScript
Stars
380
Forks
120
PR merge metrics
No merged PRs in 30d

Description

When using a BlazeDS backend and mx:RemoteObjects if there is reference to org.apache.royale.net.remoting.messages anywhere in the codebase such as having in a component :

import org.apache.royale.net.remoting.messages.ErrorMessage;

The compiler converts all mx.messaging.messages.AcknowledgeMessage received from the server
to org.apache.royale.net.remoting.messages.AcknowledgeMessage. Then during runtime the an error is thrown within the
"NetConnectionChannel.js" file line 434.

if (org.apache.royale.utils.Language.is(msg,
mx.messaging.messages.AsyncMessage)) {

as msg is now a org.apache.royale.net.remoting.messages.AcknowledgeMessage instead of a mx.messaging.messages.AcknowledgeMessage

this causes the else condition (line 446) to trigger and return a mx.FaultEvent.

Removal of any reference to org.apache.royale.net.remoting.messages fixes the issue. But the error message:

Was expecting mx.messaging.messages.AcknowledgeMessage, but received
>> org_apache_royale_net_remoting_messages_AbstractMessage__body

Doesn't really reflect the reason this is occurring, as you could have (as I did) the reference in a Visual component.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with NetConnectionChannel.js around lines 434 and 446, then trace how references to org.apache.royale.net.remoting.messages affect compilation of mx:RemoteObjects messages. Reproduce the BlazeDS case with a component importing ErrorMessage and verify that received AcknowledgeMessage instances retain the expected type and that the resulting error identifies the actual cause.

Written by the indexing model from the issue text.

Assessment

Domain
api, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.