Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356364

Summary: Three different behaviors when assign a decimal to smallint, int, and bigint
Product: z_Archived Reporter: Kathy Carroll <carrollk>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Kathy Carroll CLA 2011-08-31 12:01:30 EDT
I'm getting three different behaviors when I run my java program that assigns a decimal literal to variables of type smallint, int and bigint.  I get three different results.
  SmallInt - overflow exception
  Int - truncates and set the variable
  BigInt - java object exception

I assume EDT should work like RBD and have all three types behave like INT.

Program:

program driver type BasicProgram {}

	function main()
		try
			smallTest();
		onException(oops NumericOverflowException)
			syslib.writeStdout("  Overflow Exception ");
			syslib.writestdout("done small");
		onException(oops AnyException)
			syslib.writeStdout("  Exception " + oops.message);
			syslib.writestdout("done small");
		end
		regularTest();
		try
			bigTest();
		onException(oops NumericOverflowException)
			syslib.writeStdout("  Overflow Exception ");
			syslib.writestdout("done small");
		onException(oops AnyException)
			syslib.writeStdout("  Exception " + oops.message);
			syslib.writestdout("done big");
		end
	end
	
	function bigTest()
		syslib.writestdout("start big");
		var4 bigint = 234.4;
		var3 bigint = 234.5;
		syslib.writestdout("done big");
	end
	
	function regularTest()
		syslib.writestdout("start regular");
		var2 int = 435;
		var4 int = 234.4;
		var3 int = 234.5;
		syslib.writestdout("done regular");
	end
	
	function smallTest()
		syslib.writestdout("start small");
		var2 smallInt = 435;
		var4 smallInt = 234.4;
		var3 smallInt = 234.5;
		syslib.writestdout("done small");
	end
	
end
Comment 1 Jeff Douglas CLA 2011-09-14 12:53:22 EDT
fixed
Comment 2 Kathy Carroll CLA 2011-09-15 11:39:08 EDT
I tried with the install build 201109150902.  The bigTest is getting type mismatch java compile errors.

Is the test code provided vailid?
Comment 3 Jeff Douglas CLA 2011-09-15 11:56:07 EDT
It still works perfectly for me. I'm on the latest software for all plugins.

I had to modify the testcase to put the regularTest inside of a try block, but here's the results:

start small
  Overflow Exception 
done small
start regular
  Overflow Exception 
done small
start big
  Overflow Exception 
done small
Comment 4 Lisa Lasher CLA 2011-10-11 16:11:05 EDT
Closing this defect.