You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2013/04/19 06:25:16 UTC

[jira] [Commented] (FLEX-15171) ObjectUtil.compare() returns 0 or -1 when comparing 2 objects depending on which parameter is first.

    [ https://issues.apache.org/jira/browse/FLEX-15171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13636054#comment-13636054 ] 

Justin Mclean commented on FLEX-15171:
--------------------------------------

Confirmed in Apache Flex 4.9. Can simplify example code to:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="testMe(event)">
	<mx:Script><![CDATA[
		import mx.utils.ObjectUtil;
		import mx.events.FlexEvent;
		
		public function testMe(event:FlexEvent):void
		{
			var objA:Object = {}
			objA.a = 1;
			objA.b = 2;
			
			var objB:Object = {}
			objB.a = 1;
			
			trace("Compare=" + ObjectUtil.compare(objA, objB));
			trace("Compare=" + ObjectUtil.compare(objB, objA));
		}
  ]]></mx:Script>
 </mx:Application>
                
> ObjectUtil.compare() returns 0 or -1 when comparing 2 objects depending on which parameter is first.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: FLEX-15171
>                 URL: https://issues.apache.org/jira/browse/FLEX-15171
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: mx: General
>    Affects Versions: Adobe Flex SDK 3.0 (Release)
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Language Found: English
>            Reporter: Adobe JIRA
>            Assignee: Justin Mclean
>              Labels: easyfix, easytest
>
>       Steps To Reproduce:  Use the following code:
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="this.testMe(event)">
>   <mx:Script><![CDATA[
>       import mx.utils.ObjectUtil;
>       import mx.events.FlexEvent;
>     public function testMe(e:FlexEvent):void
>     {
>         var objA:Tester = new Tester();
>         objA.a = 1;
>         objA.b = 2;
>         
>         var objB:Tester = new Tester();
>         objB.a = 1;
>         
>         trace("Compare=" + ObjectUtil.compare(objA, objB));
>         trace("Compare=" + ObjectUtil.compare(objB, objA));
>     }
>   ]]
>       ></mx:Script>
> </mx:Application>
> The Tester class looks like this:
> package
> {
>     public dynamic class Tester extends Object
>     {
>         public function Tester()
>         {
>             super();
>         }
>     }
> }
>  
>  Actual Results:
> Compare=-1
> Compare=0
>  
>  Expected Results:
> Compare=-1
> Compare=1 
>  
>  Workaround (if any):
> Call compare twice with parameters reversed to make sure the objects are equal. Could be costly time-wise though.
>     

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira