This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit a6fc210ba842e4245e6b4d1436828f5cde0bf274
Author: greg-dove <[email protected]>
AuthorDate: Mon Feb 17 10:26:29 2020 +1300

    Fix for possible application startup issues with class aliases.
    ClassAliasBead is now processed in mxml declaration order if used in mxml. 
This resolves issues when subsequent beads expect aliases to already be 
available during their instantiation phase.
---
 .../apache/royale/reflection/beads/ClassAliasBead.as  | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git 
a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/beads/ClassAliasBead.as
 
b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/beads/ClassAliasBead.as
index 81fb0d0..3ea5bc6 100644
--- 
a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/beads/ClassAliasBead.as
+++ 
b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/beads/ClassAliasBead.as
@@ -32,6 +32,7 @@ package org.apache.royale.reflection.beads
     import org.apache.royale.core.IBead;
     import org.apache.royale.core.IFlexInfo;
     import org.apache.royale.core.IStrand;
+    import org.apache.royale.core.IDocument;
     
     /**
      *  The ClassAliasBead class is the registers class
@@ -45,7 +46,7 @@ package org.apache.royale.reflection.beads
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.0
      */
-       public class ClassAliasBead implements IBead
+       public class ClassAliasBead implements IBead, IDocument
        {
         /**
          *  Constructor.
@@ -73,6 +74,7 @@ package org.apache.royale.reflection.beads
          */
         public function set strand(value:IStrand):void
         {
+            if (_strand == value) return;
             _strand = value;
             var app:IFlexInfo = value as IFlexInfo;
             var info:Object = app.info();
@@ -88,6 +90,21 @@ package org.apache.royale.reflection.beads
                 }
             }
         }
+
+        /**
+         *  the following ensures that ClassAliasBead will be processed in 
mxml bead declaration order,
+         *  before other subsequent application beads which can run code that 
requires class aliases
+         *  for example :
+         *  a model bead that is set up from its instantiation based on 
deserialization (using class aliases) of content from local storage
+         *  @private
+         *  @royaleignorecoercion org.apache.royale.core.IStrand
+         */
+        public function setDocument(document:Object, id:String = null):void
+        {
+            if (document is IStrand) {
+                strand = IStrand(document);
+            }
+        }
             
 
     }

Reply via email to