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

Bug 364075

Summary: Stack overflow when generating a Handler that refers to External Types with circular dependency
Product: z_Archived Reporter: Paul Harmon <pharmon>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: chenzhh, hjiyong, jqian, pharmon, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Paul Harmon CLA 2011-11-17 14:26:50 EST
JS generation will throw a stack overflow when compiling the following:

externaltype romulus type JavaScriptObject
	field1 remus;
end

externaltype remus type JavaScriptObject
	field2 romulus;
end

handler Handy type RUIhandler{}
	     
	myET romulus;    
  
    function start()
	end
	
end


The root of this problem is EGLClassTemplate.genLoadScript4DependentParts(). This method recursively itself for referenced ExternalTypes. Since the ETs refer to each other, it goes into an infinite loop.
Comment 1 Jing Qian CLA 2011-11-21 15:12:16 EST
This is still happening on 201111210901's build, but I'm hoping the ET refering to each other is less likely case for end user.  

Defering
Comment 2 Huang Ji Yong CLA 2011-12-19 22:21:15 EST
Created attachment 208588 [details]
Fix
Comment 3 Huang Ji Yong CLA 2011-12-19 22:24:48 EST
The problem happens when getting the dependent external files. Tony has implement a method in HTMLGen getDependencyList which must use ISystemEnvironment.
In this fix, I keep using the "egl" and "eglx" to filter out the system part. We may need to change to the IRUtils.isSystemPart method which need to transfer the ISystemEnvironment for the js generator.
Comment 4 Huang Ji Yong CLA 2012-03-30 22:01:01 EDT
We do not support circular reference. Check the discuss in bug 373995
Comment 5 Paul Harmon CLA 2012-06-22 11:01:40 EDT
I am closing this, since it appears to work now. This was not an invalid problem, however. bug 373995 refers to circular dependencies in handlers, which must be instantiated This bug deals with external types. There is nothing invalid about cirucular references in ETs, this happens all the time in java (and JS)