Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359368 - Cannot cast from short/int to boolean
Summary: Cannot cast from short/int to boolean
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-09-29 04:58 EDT by pf yu CLA
Modified: 2017-02-23 14:17 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pf yu CLA 2011-09-29 04:58:02 EDT
Build Identifier: 201109282102

The generated Java code is:
	public void runDateAndTime11() {
		Calendar ts = ETimestamp.defaultValue();
		eze_Lib_org_eclipse_edt_eunit_runtime_LogResult().logStdOut("variation 11");
		n = ETimestamp.dayOf(ts);
		boolean eze$Temp5;
		eze$Temp5 = (boolean)((short) 2);
		eze_Lib_org_eclipse_edt_eunit_runtime_LogResult().assertTrue("2", eze$Temp5);
	}

Cannot cast from short to boolean

Reproducible: Always

Steps to Reproduce:
1. Check out project "org.eclipse.edt.eunit.test" from kan-cvs.
2. Add java generator to the project.
3. Clean the whole workspace.
4. The errors exist in the following java files:
fvt.datatypes.TestDateAndTime04Lib
Comment 1 Matt Heitz CLA 2011-09-29 10:00:09 EDT
The problem is from this line of code.

  LogResult.assertTrue("2", 2);

The function being called looks like this.

  function assertTrue(failedReason String in, testCondition boolean in)

Notice that the argument is a smallint and the parameter is a boolean.  In EDT, numeric types are incompatible with booleans.  There should be a validation error on the function invocation.

Peng Fei, I think you should change the testcase.
Comment 2 pf yu CLA 2011-09-29 23:24:55 EDT
Thanks Matt, It's error of test case itself, instead of a bug.
I'll change the test case and close this defect.
Comment 3 Matt Heitz CLA 2011-10-03 11:04:28 EDT
I'm reopening this bug, with the severity set back to Normal, because validation needs to mark that argument as invalid for the parameter.
Comment 4 Paul Harmon CLA 2011-11-01 11:28:20 EDT
Validation is already flagging this as an error. It must have been fixed already.
Comment 5 pf yu CLA 2011-11-08 03:03:29 EST
Verified in build 20111107.