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

Bug 367259

Summary: Nullable record field in a record becomes null when parent record is returned from a function
Product: z_Archived Reporter: Will Smythe <smythew>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 367261    
Attachments:
Description Flags
Sample project that demonstrates the issue. none

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.