Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359373 - Type mismatch: cannot convert from null to boolean/int/long/float/double
Summary: Type mismatch: cannot convert from null to boolean/int/long/float/double
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-29 05:12 EDT by pf yu CLA
Modified: 2017-02-23 14:16 EST (History)
5 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 05:12:26 EDT
Build Identifier: 201109282102

Type mismatch: cannot convert from null to int/long

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. Such errors exist in many places, for example:
fvt.librarysupport.TestMathLib2Lib
Comment 1 Matt Heitz CLA 2011-09-29 10:18:19 EDT
This is a valid defect, but the testcases should be changed to avoid it.

The problem happens when null is passed as an argument to a function, and the function's parameter is not nullable.

For example, fvt.librarysupport.TestMathLib2LibtestStringAsInt4() contains this line
  LogResult.assertBigIntEqual1(null, nullableBigint);

And the first parameter of assertBigIntEqual1 is "expected bigint in".  Notice that it's not nullable.

In RBD you can pass null to a non-nullable parameter, and it's like passing in the variable's default value (zero, empty string, etc. depending on the parameter's type).  But in EDT if you assign null to a non-nullable variable, or pass null to a non-nullable parameter, we'll throw a NullValueException.  In other words, once the JavaGen error is fixed, this code won't work.
Comment 2 Jeff Douglas CLA 2011-09-30 11:12:08 EDT
a different fix must have corrected this.
Comment 3 pf yu CLA 2011-10-21 04:21:17 EDT
Verified in build 20111020