WARNING

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

WARNING

Serkan Taş
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
Reply | Threaded
Open this post in threaded view
|

Re: WARNING

Alex Harui-2

It may not work to define static constants from ResourceManager.

 

HTH,

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, November 1, 2019 at 1:47 PM
To: "[hidden email]" <[hidden email]>
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"
               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

Reply | Threaded
Open this post in threaded view
|

Re: WARNING

Greg Dove

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 <[hidden email]> wrote:

It may not work to define static constants from ResourceManager.

 

HTH,

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, November 1, 2019 at 1:47 PM
To: "[hidden email]" <[hidden email]>
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"
               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

Reply | Threaded
Open this post in threaded view
|

Re: WARNING

Serkan Taş
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 <[hidden email]> wrote:

It may not work to define static constants from ResourceManager.

 

HTH,

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, November 1, 2019 at 1:47 PM
To: "[hidden email]" <[hidden email]>
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"
               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


Reply | Threaded
Open this post in threaded view
|

Re: WARNING

Serkan Taş
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 <[hidden email]> wrote:

It may not work to define static constants from ResourceManager.

 

HTH,

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, November 1, 2019 at 1:47 PM
To: "[hidden email]" <[hidden email]>
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"
               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



Reply | Threaded
Open this post in threaded view
|

***UNCHECKED*** Re: WARNING

Alex Harui-2

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ş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, November 1, 2019 at 2:54 PM
To: "[hidden email]" <[hidden email]>
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 <[hidden email]> wrote:

It may not work to define static constants from ResourceManager.

 

HTH,

-Alex

 

From: Serkan Taş <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, November 1, 2019 at 1:47 PM
To: "[hidden email]" <[hidden email]>
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"
               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