Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364075 - Stack overflow when generating a Handler that refers to External Types with circular dependency
Summary: Stack overflow when generating a Handler that refers to External Types with c...
Status: CLOSED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Huang Ji Yong CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-17 14:26 EST by Paul Harmon CLA
Modified: 2017-02-23 14:17 EST (History)
5 users (show)

See Also:


Attachments
Fix (4.33 KB, patch)
2011-12-19 22:21 EST, Huang Ji Yong CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)