Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367259 - Nullable record field in a record becomes null when parent record is returned from a function
Summary: Nullable record field in a record becomes null when parent record is returned...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 367261
  Show dependency tree
 
Reported: 2011-12-20 19:02 EST by Will Smythe CLA
Modified: 2017-02-23 14:20 EST (History)
2 users (show)

See Also:


Attachments
Sample project that demonstrates the issue. (54.64 KB, application/x-zip-compressed)
2011-12-20 19:02 EST, Will Smythe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Will Smythe CLA 2011-12-20 19:02:14 EST
I have the following records (note 'c' is marked as nullable):

record CustomerWithResults
	r Results;
        c Customer?; 
end

record Results
    succeeded boolean;
    returnCode int;
end

record Customer
    id int;
    name string;
end

If I define a function that populates a CustomerWithResults (i.e. sets a new Results on the 'r' field and a Customer on the 'c' field) and returns it, the 'c' (Customer) value is returned as null (regardless of whether the value was null or not). If I make the 'c' field non-nullable, the field's value is not lost when returned. So, something is happening with record fields marked as nullable.

See TestRecords.egl, TestService.egl, and TestHandler.egl in the attached project. TestService.getCustomerWithResults() demonstrates the problem.
Comment 1 Will Smythe CLA 2011-12-20 19:02:37 EST
Created attachment 208650 [details]
Sample project that demonstrates the issue.
Comment 2 Will Smythe CLA 2011-12-20 19:06:04 EST
If I add a nullable primitive (see 'test') to the CustomerWithResults record ...

record CustomerWithResults

	r Results;
	c Customer?;
	
	test int?;
	
end

The value of 'test' is not lost when returned from my function. So, it seems the issue may be specific to nullable record fields in a record, not necessarily nullable primitive fields.
Comment 3 Jeff Douglas CLA 2011-12-22 21:36:39 EST
fixed
Comment 4 Will Smythe CLA 2012-02-21 08:01:33 EST
Verified in 2/20 nightly build.