Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359899 - Generated Java errors when implicitly or explicitly cast Number function parameter
Summary: Generated Java errors when implicitly or explicitly cast Number function para...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 14:57 EDT by Kathy Carroll CLA
Modified: 2017-02-23 14:16 EST (History)
2 users (show)

See Also:


Attachments
miniTest library (1.44 KB, application/octet-stream)
2011-10-04 14:58 EDT, Kathy Carroll CLA
no flags Details
Project Archive File (114.80 KB, application/x-zip-compressed)
2011-10-05 09:39 EDT, Kathy Carroll CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kathy Carroll CLA 2011-10-04 14:57:02 EDT
The first two functions produce this java compile message: The method asInt(Short) in the type EInt is not applicable for the arguments (ENumber
and
The method asSmallint(Short) in the type ESmallint is not applicable for the arguments (ENumber)

   function switchOnInOutNumberParameter(localLen number inOut)
    	substep int = localLen as Int;
    	converted smallInt = localLen as smallInt;
    end
    
   function switchOnInNumberParameter(localLen number in)
    	substep int = localLen;
    	converted smallInt = localLen as smallInt;
   end
    
   function switchOnInOutAnyParameter(localLen any inOut)
    	substep int = localLen;
    	converted smallInt = localLen as smallInt;
    end
   
   function switchOnInAnyParameter(localLen any in)
    	substep int = localLen;
    	converted smallInt = localLen as smallInt;
    end
    
    function numberInlineTest()
    	local number = 3;
    	substep int = local as Int;
    	converted smallInt = local as smallInt;
    end
    
   function anyInlineTest()
    	local any = 3;
    	substep int = local as Int;
    	converted smallInt = local as smallInt;
    end
Comment 1 Kathy Carroll CLA 2011-10-04 14:58:39 EDT
Created attachment 204544 [details]
miniTest library
Comment 2 Kathy Carroll CLA 2011-10-04 15:14:02 EDT
I think this is related

library miniTest2

	function testLiterals()
		recieverINOUT( 1 as number);
		recieverIN( 2 as number );
	end
	
	function testVariables()
		var number = 23.234;
		var = 1 as number;
		recieverINOUT(var);
		var = 2 as number;
		recieverIN(var);
	end
	
	function recieverINOUT(incoming number inOut);
	end
	
	function recieverIN(incoming number inOut);
	end
	
end
Comment 3 Kathy Carroll CLA 2011-10-05 09:39:13 EDT
Created attachment 204594 [details]
Project Archive File

More variations for number to decimal
Comment 4 Jeff Douglas CLA 2011-10-20 13:30:14 EDT
fixed
Comment 5 Kathy Carroll CLA 2011-10-25 12:21:03 EDT
with build 201110241434.  This still give java compile errors:

library miniTest2

    function testLiterals()
        recieverINOUT( 1 as number);
        recieverIN( 2 as number );
    end

    function testVariables()
        var number = 23.234;
        var = 1 as number;
        recieverINOUT(var);
        var = 2 as number;
        recieverIN(var);
    end

    function recieverINOUT(incoming number inOut);
    end

    function recieverIN(incoming number inOut);
    end

end
Comment 6 Jeff Douglas CLA 2011-10-26 14:08:38 EDT
fixed
Comment 7 Kathy Carroll CLA 2011-11-01 09:56:01 EDT
tried with 20111031_20101.  I still have a failure on this variation. I do get the result I desire with JavaScript.

program driver type BasicProgram {}

	function main()
		pass number = 123.45;
		received decimal(5,2) = 123.45;
		answer decimal(5,2) = convertNumberToSpecificDecimalHack(pass);
		if (received == answer)
			syslib.writestdout("works");
		else
			syslib.writestdout("fails");
			syslib.writestdout(answer);
		end
	end
	
	function convertNumberToSpecificDecimalHack(incoming number in) returns (decimal(5,2))
		result decimal(5,2) = 234.34;
		try
		//	LogResult.logStdOut("number conversion issue 359899 ");
			result = (incoming as any ) as decimal(5,2);
		onException(oops AnyException)
			stuff string = "runtime error " + oops. message;
			syslib.writestdout("number conversion issue 359899 (runtime error)");
			syslib.writestdout(stuff);
		end
		return (result);
	end
end
Comment 8 Jeff Douglas CLA 2011-11-01 10:32:01 EDT
fixed
Comment 9 Kathy Carroll CLA 2011-11-11 13:48:11 EST
verfied with 20111111_0901 and closed