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

Bug 357887

Summary: Generated code for a new expression should be more efficient
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt Heitz CLA 2011-09-15 17:30:06 EDT
Generate this code...

rr R1;
rr = new R1{ i = 7 };

It'll be something like this...

R1 eze$Temp1 = new R1();
{
	R1 eze$SettingTarget1 = new R1();
	eze$SettingTarget1.i = (int)((short) 7);
	org.eclipse.edt.runtime.java.egl.lang.AnyValue.ezeCopyTo(eze$SettingTarget1, eze$Temp1);
}
org.eclipse.edt.runtime.java.egl.lang.AnyValue.ezeCopyTo(eze$Temp1, rr);



Notice that we make TWO new records.  We shouldn't initialize eze$Temp1, and the last line inside the block should be "eze$Temp1 = eze$SettingTarget1;".
Comment 1 Jeff Douglas CLA 2011-09-23 12:08:25 EDT
fixed
Comment 2 Matt Heitz CLA 2011-10-04 14:33:28 EDT
I'm closing this since we no longer make two records in the statement.  We still have the problem that we're calling AnyValue.ezeCopyTo twice: as I wrote, the last line inside the block should be "eze$Temp1 = eze$SettingTarget1;".  I'll let it go for now.