You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Serkan Taş <se...@likyateknoloji.com> on 2019/11/01 20:07:45 UTC

WARNING

Hi,

Need and advice, I am getting a compiler warning that appears as an 
exception in web console :

WARNING: 
D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/main/mtest/FindBug.js:141: 
WARNING - mx.resources.ResourceManager.getInstance defined before its 
owner. mx.resources.ResourceManager is defined at 
D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/mx/resources/ResourceManager.js:19
main.mtest.FindBug.ERROR = 
mx.resources.ResourceManager.getInstance().getString('messages', 'error');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


And the exception :

FindBug.js:141 Uncaught TypeError: Cannot read property 
'ResourceManager' of undefined
     at FindBug.js:141
(anonymous) @ FindBug.js:141
SystemManager.js:231 Uncaught TypeError: Cannot read property 'mixins' 
of undefined
     at 
FindBug_mx_managers_SystemManager.mx.managers.SystemManager.start 
(SystemManager.js:231)
     at index.html:366

The source piece :

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.apache.org/royale/spark"
                xmlns:mx="library://ns.apache.org/royale/mx"
                paddingBottom="0" paddingTop="0" paddingLeft="0" 
paddingRight="0"
                height="100%" width="100%"
                creationComplete="onCreationComplete()"
                xmlns:comps="com.likya.pinara.comps.*"
                >

     <fx:Metadata>
         [ResourceBundle("messages")]
     </fx:Metadata>

     <fx:Script>
         <![CDATA[
             import mx.resources.ResourceManager;

             public static const ERROR:String = 
ResourceManager.getInstance().getString('messages', 'error');

             public function onCreationComplete():void {

             }

             protected function button_clickHandler(event:MouseEvent):void {
             }

         ]]>
     </fx:Script>

     <fx:Declarations>
     </fx:Declarations>

     <s:layout>
         <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" 
paddingTop="10" paddingBottom="20" />
     </s:layout>

     <s:Button id="button" width="200" label="Show/Hide" 
click="button_clickHandler(event)"/>

     <mx:Panel title="Form Container Example"
               paddingBottom="10" paddingTop="10" paddingLeft="10" 
paddingRight="10"
               height="100%" width="100%">

         <mx:Text width="100%"
                  text="Moving from one form field to another triggers 
the validator."/>

         <mx:Form width="100%" height="100%" >
             <mx:FormHeading label="Enter values into the form."/>

             <mx:FormItem label="First name" >
                 <mx:TextInput id="fname" width="200"/>
             </mx:FormItem>

             <mx:FormItem label="{resourceManager.getString('messages', 
'userName')}">
                 <mx:TextInput id="username" width="200"/>
             </mx:FormItem>
         </mx:Form>

     </mx:Panel>

</s:Application>

Thanks,
Serkan

Re: WARNING

Posted by Alex Harui <ah...@adobe.com>.
No, it is probably that by the time the custom class is static initialized, ResourceManager has been loaded.  Getting the order of loading static things remains a work in progress.

-Alex

From: Serkan Taş <se...@likyateknoloji.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Friday, November 1, 2019 at 2:54 PM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: WARNING

It worked for the test case.

I guess the constant declarations in custom classes are initialized immediately  if the class is name referenced in the component even if it is not called.
2.11.2019 00:40 tarihinde Serkan Taş yazdı:
Good to be able to move forward without making so much changes in the original code Greg,

Thanks,
Serkan
2.11.2019 00:32 tarihinde Greg Dove yazdı:

Yeah, I have also seen things like that, although not specifically with ResourceManager, I recall seeing it with instances of custom classes.
To keep things as close as possible to the original code, the way I have addressed this in the past it is to convert the static const into a static getter, with the instance constructed the first time the getter is accessed.
private static var _ERROR:String
public static function get ERROR():String { if (_ERROR) return _ERROR;  _ERROR = ResourceManager.getInstance().getString('messages', 'error'); return _ERROR }

you could probably opt out of the local private storage variable and simply return the value from ResourceManager, but that might change if locale changes happen (which I don't know if we support yet, I did not check that).

On Sat, Nov 2, 2019 at 10:21 AM Alex Harui <ah...@adobe.com>> wrote:
It may not work to define static constants from ResourceManager.

HTH,
-Alex

From: Serkan Taş <se...@likyateknoloji.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, November 1, 2019 at 1:47 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: WARNING

Hi,

Need and advice, I am getting a compiler warning that appears as an exception in web console :

WARNING: D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/main/mtest/FindBug.js:141: WARNING - mx.resources.ResourceManager.getInstance defined before its owner. mx.resources.ResourceManager is defined at D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/mx/resources/ResourceManager.js:19
main.mtest.FindBug.ERROR = mx.resources.ResourceManager.getInstance().getString('messages', 'error');
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


And the exception :

FindBug.js:141 Uncaught TypeError: Cannot read property 'ResourceManager' of undefined
    at FindBug.js:141
(anonymous) @ FindBug.js:141
SystemManager.js:231 Uncaught TypeError: Cannot read property 'mixins' of undefined
    at FindBug_mx_managers_SystemManager.mx.managers.SystemManager.start (SystemManager.js:231)
    at index.html:366

The source piece :

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7Ca8091d961806479a861a08d75f160c64%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082420647701965&sdata=y3gJfJLbOnnaeoqwwpQMsNJI6znwRQhAAl4WACRftiM%3D&reserved=0>
               xmlns:s="library://ns.apache.org/royale/spark<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fspark&data=02%7C01%7Caharui%40adobe.com%7Ca8091d961806479a861a08d75f160c64%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082420647711968&sdata=E6Cdb6CBVHwNl1jgehG0aZOlN%2B0rWume39b%2BDEWRUqY%3D&reserved=0>"
               xmlns:mx="library://ns.apache.org/royale/mx<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fmx&data=02%7C01%7Caharui%40adobe.com%7Ca8091d961806479a861a08d75f160c64%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082420647711968&sdata=AdfKM%2Bc9Bd9V1m1IwcA%2BpVoDQGiEJwS6NdSfG8BXjic%3D&reserved=0>"
               paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0"
               height="100%" width="100%"
               creationComplete="onCreationComplete()"
               xmlns:comps="com.likya.pinara.comps.*"
               >

    <fx:Metadata>
        [ResourceBundle("messages")]
    </fx:Metadata>

    <fx:Script>
        <![CDATA[
            import mx.resources.ResourceManager;

            public static const ERROR:String = ResourceManager.getInstance().getString('messages', 'error');

            public function onCreationComplete():void {

            }

            protected function button_clickHandler(event:MouseEvent):void {
            }

        ]]>
    </fx:Script>

    <fx:Declarations>
    </fx:Declarations>

    <s:layout>
        <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
    </s:layout>

    <s:Button id="button" width="200" label="Show/Hide" click="button_clickHandler(event)"/>

    <mx:Panel title="Form Container Example"
              paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10"
              height="100%" width="100%">

        <mx:Text width="100%"
                 text="Moving from one form field to another triggers the validator."/>

        <mx:Form width="100%" height="100%" >
            <mx:FormHeading label="Enter values into the form."/>

            <mx:FormItem label="First name" >
                <mx:TextInput id="fname" width="200"/>
            </mx:FormItem>

            <mx:FormItem label="{resourceManager.getString('messages', 'userName')}">
                <mx:TextInput id="username" width="200"/>
            </mx:FormItem>
        </mx:Form>

    </mx:Panel>

</s:Application>

Thanks,
Serkan




Re: WARNING

Posted by Serkan Taş <se...@likyateknoloji.com>.
It worked for the test case.

I guess the constant declarations in custom classes are initialized 
immediately  if the class is name referenced in the component even if it 
is not called.

2.11.2019 00:40 tarihinde Serkan Taş yazdı:
> Good to be able to move forward without making so much changes in the 
> original code Greg,
>
> Thanks,
> Serkan
>
> 2.11.2019 00:32 tarihinde Greg Dove yazdı:
>>
>> Yeah, I have also seen things like that, although not specifically 
>> with ResourceManager, I recall seeing it with instances of custom 
>> classes.
>> To keep things as close as possible to the original code, the way I 
>> have addressed this in the past it is to convert the static const 
>> into a static getter, with the instance constructed the first time 
>> the getter is accessed.
>> private static var _ERROR:String
>> public static function get ERROR():String { if (_ERROR) return 
>> _ERROR;  _ERROR = ResourceManager.getInstance().getString('messages', 
>> 'error'); return _ERROR }
>>
>> you could probably opt out of the local private storage variable and 
>> simply return the value from ResourceManager, but that might change 
>> if locale changes happen (which I don't know if we support yet, I did 
>> not check that).
>>
>> On Sat, Nov 2, 2019 at 10:21 AM Alex Harui <aharui@adobe.com 
>> <ma...@adobe.com>> wrote:
>>
>>     It may not work to define static constants from ResourceManager.
>>
>>     HTH,
>>
>>     -Alex
>>
>>     *From: *Serkan Taş <serkan.tas@likyateknoloji.com
>>     <ma...@likyateknoloji.com>>
>>     *Reply-To: *"users@royale.apache.org
>>     <ma...@royale.apache.org>" <users@royale.apache.org
>>     <ma...@royale.apache.org>>
>>     *Date: *Friday, November 1, 2019 at 1:47 PM
>>     *To: *"users@royale.apache.org <ma...@royale.apache.org>"
>>     <users@royale.apache.org <ma...@royale.apache.org>>
>>     *Subject: *WARNING
>>
>>     Hi,
>>
>>     Need and advice, I am getting a compiler warning that appears as
>>     an exception in web console :
>>
>>     WARNING:
>>     D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/main/mtest/FindBug.js:141:
>>     WARNING - mx.resources.ResourceManager.getInstance defined before
>>     its owner. mx.resources.ResourceManager is defined at
>>     D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/mx/resources/ResourceManager.js:19
>>     main.mtest.FindBug.ERROR =
>>     mx.resources.ResourceManager.getInstance().getString('messages',
>>     'error');
>>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>
>>     And the exception :
>>
>>     FindBug.js:141 Uncaught TypeError: Cannot read property
>>     'ResourceManager' of undefined
>>         at FindBug.js:141
>>     (anonymous) @ FindBug.js:141
>>     SystemManager.js:231 Uncaught TypeError: Cannot read property
>>     'mixins' of undefined
>>         at
>>     FindBug_mx_managers_SystemManager.mx.managers.SystemManager.start
>>     (SystemManager.js:231)
>>         at index.html:366
>>
>>     The source piece :
>>
>>     <?xml version="1.0" encoding="utf-8"?>
>>     <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>>     <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C19e026478f6c4b7237cf08d75f0ca489%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082380221864549&sdata=%2B%2BuxytHojeYDlAVSDLry850kQE1aCNeMEhZG%2BZdq5mg%3D&reserved=0>
>>                    xmlns:s="library://ns.apache.org/royale/spark
>>     <http://ns.apache.org/royale/spark>"
>>                    xmlns:mx="library://ns.apache.org/royale/mx
>>     <http://ns.apache.org/royale/mx>"
>>                    paddingBottom="0" paddingTop="0" paddingLeft="0"
>>     paddingRight="0"
>>                    height="100%" width="100%"
>>     creationComplete="onCreationComplete()"
>>     xmlns:comps="com.likya.pinara.comps.*"
>>                    >
>>
>>         <fx:Metadata>
>>             [ResourceBundle("messages")]
>>         </fx:Metadata>
>>
>>         <fx:Script>
>>             <![CDATA[
>>                 import mx.resources.ResourceManager;
>>
>>                 public static const ERROR:String =
>>     ResourceManager.getInstance().getString('messages', 'error');
>>
>>                 public function onCreationComplete():void {
>>
>>                 }
>>
>>                 protected function
>>     button_clickHandler(event:MouseEvent):void {
>>                 }
>>
>>             ]]>
>>         </fx:Script>
>>
>>         <fx:Declarations>
>>         </fx:Declarations>
>>
>>         <s:layout>
>>             <s:VerticalLayout gap="10" paddingRight="10"
>>     paddingLeft="10" paddingTop="10" paddingBottom="20" />
>>         </s:layout>
>>
>>         <s:Button id="button" width="200" label="Show/Hide"
>>     click="button_clickHandler(event)"/>
>>
>>         <mx:Panel title="Form Container Example"
>>                   paddingBottom="10" paddingTop="10" paddingLeft="10"
>>     paddingRight="10"
>>                   height="100%" width="100%">
>>
>>             <mx:Text width="100%"
>>                      text="Moving from one form field to another
>>     triggers the validator."/>
>>
>>             <mx:Form width="100%" height="100%" >
>>                 <mx:FormHeading label="Enter values into the form."/>
>>
>>                 <mx:FormItem label="First name" >
>>                     <mx:TextInput id="fname" width="200"/>
>>                 </mx:FormItem>
>>
>>                 <mx:FormItem
>>     label="{resourceManager.getString('messages', 'userName')}">
>>                     <mx:TextInput id="username" width="200"/>
>>                 </mx:FormItem>
>>             </mx:Form>
>>
>>         </mx:Panel>
>>
>>     </s:Application>
>>
>>     Thanks,
>>     Serkan
>>
>


Re: WARNING

Posted by Serkan Taş <se...@likyateknoloji.com>.
Good to be able to move forward without making so much changes in the 
original code Greg,

Thanks,
Serkan

2.11.2019 00:32 tarihinde Greg Dove yazdı:
>
> Yeah, I have also seen things like that, although not specifically 
> with ResourceManager, I recall seeing it with instances of custom classes.
> To keep things as close as possible to the original code, the way I 
> have addressed this in the past it is to convert the static const into 
> a static getter, with the instance constructed the first time the 
> getter is accessed.
> private static var _ERROR:String
> public static function get ERROR():String { if (_ERROR) return _ERROR; 
> _ERROR = ResourceManager.getInstance().getString('messages', 'error'); 
> return _ERROR }
>
> you could probably opt out of the local private storage variable and 
> simply return the value from ResourceManager, but that might change if 
> locale changes happen (which I don't know if we support yet, I did not 
> check that).
>
> On Sat, Nov 2, 2019 at 10:21 AM Alex Harui <aharui@adobe.com 
> <ma...@adobe.com>> wrote:
>
>     It may not work to define static constants from ResourceManager.
>
>     HTH,
>
>     -Alex
>
>     *From: *Serkan Taş <serkan.tas@likyateknoloji.com
>     <ma...@likyateknoloji.com>>
>     *Reply-To: *"users@royale.apache.org
>     <ma...@royale.apache.org>" <users@royale.apache.org
>     <ma...@royale.apache.org>>
>     *Date: *Friday, November 1, 2019 at 1:47 PM
>     *To: *"users@royale.apache.org <ma...@royale.apache.org>"
>     <users@royale.apache.org <ma...@royale.apache.org>>
>     *Subject: *WARNING
>
>     Hi,
>
>     Need and advice, I am getting a compiler warning that appears as
>     an exception in web console :
>
>     WARNING:
>     D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/main/mtest/FindBug.js:141:
>     WARNING - mx.resources.ResourceManager.getInstance defined before
>     its owner. mx.resources.ResourceManager is defined at
>     D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/mx/resources/ResourceManager.js:19
>     main.mtest.FindBug.ERROR =
>     mx.resources.ResourceManager.getInstance().getString('messages',
>     'error');
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
>     And the exception :
>
>     FindBug.js:141 Uncaught TypeError: Cannot read property
>     'ResourceManager' of undefined
>         at FindBug.js:141
>     (anonymous) @ FindBug.js:141
>     SystemManager.js:231 Uncaught TypeError: Cannot read property
>     'mixins' of undefined
>         at
>     FindBug_mx_managers_SystemManager.mx.managers.SystemManager.start
>     (SystemManager.js:231)
>         at index.html:366
>
>     The source piece :
>
>     <?xml version="1.0" encoding="utf-8"?>
>     <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>     <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C19e026478f6c4b7237cf08d75f0ca489%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082380221864549&sdata=%2B%2BuxytHojeYDlAVSDLry850kQE1aCNeMEhZG%2BZdq5mg%3D&reserved=0>
>                    xmlns:s="library://ns.apache.org/royale/spark
>     <http://ns.apache.org/royale/spark>"
>                    xmlns:mx="library://ns.apache.org/royale/mx
>     <http://ns.apache.org/royale/mx>"
>                    paddingBottom="0" paddingTop="0" paddingLeft="0"
>     paddingRight="0"
>                    height="100%" width="100%"
>                    creationComplete="onCreationComplete()"
>                    xmlns:comps="com.likya.pinara.comps.*"
>                    >
>
>         <fx:Metadata>
>             [ResourceBundle("messages")]
>         </fx:Metadata>
>
>         <fx:Script>
>             <![CDATA[
>                 import mx.resources.ResourceManager;
>
>                 public static const ERROR:String =
>     ResourceManager.getInstance().getString('messages', 'error');
>
>                 public function onCreationComplete():void {
>
>                 }
>
>                 protected function
>     button_clickHandler(event:MouseEvent):void {
>                 }
>
>             ]]>
>         </fx:Script>
>
>         <fx:Declarations>
>         </fx:Declarations>
>
>         <s:layout>
>             <s:VerticalLayout gap="10" paddingRight="10"
>     paddingLeft="10" paddingTop="10" paddingBottom="20" />
>         </s:layout>
>
>         <s:Button id="button" width="200" label="Show/Hide"
>     click="button_clickHandler(event)"/>
>
>         <mx:Panel title="Form Container Example"
>                   paddingBottom="10" paddingTop="10" paddingLeft="10"
>     paddingRight="10"
>                   height="100%" width="100%">
>
>             <mx:Text width="100%"
>                      text="Moving from one form field to another
>     triggers the validator."/>
>
>             <mx:Form width="100%" height="100%" >
>                 <mx:FormHeading label="Enter values into the form."/>
>
>                 <mx:FormItem label="First name" >
>                     <mx:TextInput id="fname" width="200"/>
>                 </mx:FormItem>
>
>                 <mx:FormItem
>     label="{resourceManager.getString('messages', 'userName')}">
>                     <mx:TextInput id="username" width="200"/>
>                 </mx:FormItem>
>             </mx:Form>
>
>         </mx:Panel>
>
>     </s:Application>
>
>     Thanks,
>     Serkan
>


Re: WARNING

Posted by Greg Dove <gr...@gmail.com>.
Yeah, I have also seen things like that, although not specifically with
ResourceManager, I recall seeing it with instances of custom classes.
To keep things as close as possible to the original code, the way I have
addressed this in the past it is to convert the static const into a static
getter, with the instance constructed the first time the getter is accessed.
private static var _ERROR:String
public static function get ERROR():String { if (_ERROR) return _ERROR;
_ERROR = ResourceManager.getInstance().getString('messages', 'error');
return _ERROR }

you could probably opt out of the local private storage variable and simply
return the value from ResourceManager, but that might change if locale
changes happen (which I don't know if we support yet, I did not check that).

On Sat, Nov 2, 2019 at 10:21 AM Alex Harui <ah...@adobe.com> wrote:

> It may not work to define static constants from ResourceManager.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *Serkan Taş <se...@likyateknoloji.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, November 1, 2019 at 1:47 PM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *WARNING
>
>
>
> Hi,
>
> Need and advice, I am getting a compiler warning that appears as an
> exception in web console :
>
> WARNING:
> D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/main/mtest/FindBug.js:141:
> WARNING - mx.resources.ResourceManager.getInstance defined before its
> owner. mx.resources.ResourceManager is defined at
> D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/mx/resources/ResourceManager.js:19
> main.mtest.FindBug.ERROR =
> mx.resources.ResourceManager.getInstance().getString('messages', 'error');
>                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
> And the exception :
>
> FindBug.js:141 Uncaught TypeError: Cannot read property 'ResourceManager'
> of undefined
>     at FindBug.js:141
> (anonymous) @ FindBug.js:141
> SystemManager.js:231 Uncaught TypeError: Cannot read property 'mixins' of
> undefined
>     at FindBug_mx_managers_SystemManager.mx.managers.SystemManager.start
> (SystemManager.js:231)
>     at index.html:366
>
> The source piece :
>
> <?xml version="1.0" encoding="utf-8"?>
> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C19e026478f6c4b7237cf08d75f0ca489%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082380221864549&sdata=%2B%2BuxytHojeYDlAVSDLry850kQE1aCNeMEhZG%2BZdq5mg%3D&reserved=0>
>                xmlns:s="library://ns.apache.org/royale/spark"
>                xmlns:mx="library://ns.apache.org/royale/mx"
>                paddingBottom="0" paddingTop="0" paddingLeft="0"
> paddingRight="0"
>                height="100%" width="100%"
>                creationComplete="onCreationComplete()"
>                xmlns:comps="com.likya.pinara.comps.*"
>                >
>
>     <fx:Metadata>
>         [ResourceBundle("messages")]
>     </fx:Metadata>
>
>     <fx:Script>
>         <![CDATA[
>             import mx.resources.ResourceManager;
>
>             public static const ERROR:String =
> ResourceManager.getInstance().getString('messages', 'error');
>
>             public function onCreationComplete():void {
>
>             }
>
>             protected function button_clickHandler(event:MouseEvent):void {
>             }
>
>         ]]>
>     </fx:Script>
>
>     <fx:Declarations>
>     </fx:Declarations>
>
>     <s:layout>
>         <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10"
> paddingTop="10" paddingBottom="20" />
>     </s:layout>
>
>     <s:Button id="button" width="200" label="Show/Hide"
> click="button_clickHandler(event)"/>
>
>     <mx:Panel title="Form Container Example"
>               paddingBottom="10" paddingTop="10" paddingLeft="10"
> paddingRight="10"
>               height="100%" width="100%">
>
>         <mx:Text width="100%"
>                  text="Moving from one form field to another triggers the
> validator."/>
>
>         <mx:Form width="100%" height="100%" >
>             <mx:FormHeading label="Enter values into the form."/>
>
>             <mx:FormItem label="First name" >
>                 <mx:TextInput id="fname" width="200"/>
>             </mx:FormItem>
>
>             <mx:FormItem label="{resourceManager.getString('messages',
> 'userName')}">
>                 <mx:TextInput id="username" width="200"/>
>             </mx:FormItem>
>         </mx:Form>
>
>     </mx:Panel>
>
> </s:Application>
>
> Thanks,
> Serkan
>
>

Re: WARNING

Posted by Alex Harui <ah...@adobe.com>.
It may not work to define static constants from ResourceManager.

HTH,
-Alex

From: Serkan Taş <se...@likyateknoloji.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Friday, November 1, 2019 at 1:47 PM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: WARNING

Hi,

Need and advice, I am getting a compiler warning that appears as an exception in web console :

WARNING: D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/main/mtest/FindBug.js:141: WARNING - mx.resources.ResourceManager.getInstance defined before its owner. mx.resources.ResourceManager is defined at D:/dev/royale-emulation-works/github/royale-testing/src/main/mtest/bin/js-debug/mx/resources/ResourceManager.js:19
main.mtest.FindBug.ERROR = mx.resources.ResourceManager.getInstance().getString('messages', 'error');
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


And the exception :

FindBug.js:141 Uncaught TypeError: Cannot read property 'ResourceManager' of undefined
    at FindBug.js:141
(anonymous) @ FindBug.js:141
SystemManager.js:231 Uncaught TypeError: Cannot read property 'mixins' of undefined
    at FindBug_mx_managers_SystemManager.mx.managers.SystemManager.start (SystemManager.js:231)
    at index.html:366

The source piece :

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C19e026478f6c4b7237cf08d75f0ca489%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637082380221864549&sdata=%2B%2BuxytHojeYDlAVSDLry850kQE1aCNeMEhZG%2BZdq5mg%3D&reserved=0>
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0"
               height="100%" width="100%"
               creationComplete="onCreationComplete()"
               xmlns:comps="com.likya.pinara.comps.*"
               >

    <fx:Metadata>
        [ResourceBundle("messages")]
    </fx:Metadata>

    <fx:Script>
        <![CDATA[
            import mx.resources.ResourceManager;

            public static const ERROR:String = ResourceManager.getInstance().getString('messages', 'error');

            public function onCreationComplete():void {

            }

            protected function button_clickHandler(event:MouseEvent):void {
            }

        ]]>
    </fx:Script>

    <fx:Declarations>
    </fx:Declarations>

    <s:layout>
        <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
    </s:layout>

    <s:Button id="button" width="200" label="Show/Hide" click="button_clickHandler(event)"/>

    <mx:Panel title="Form Container Example"
              paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10"
              height="100%" width="100%">

        <mx:Text width="100%"
                 text="Moving from one form field to another triggers the validator."/>

        <mx:Form width="100%" height="100%" >
            <mx:FormHeading label="Enter values into the form."/>

            <mx:FormItem label="First name" >
                <mx:TextInput id="fname" width="200"/>
            </mx:FormItem>

            <mx:FormItem label="{resourceManager.getString('messages', 'userName')}">
                <mx:TextInput id="username" width="200"/>
            </mx:FormItem>
        </mx:Form>

    </mx:Panel>

</s:Application>

Thanks,
Serkan