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

Bug 320420

Summary: Unnecessary load of all registered EPackages
Product: [Modeling] TMF Reporter: Ed Willink <ed>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow, tokraemercli
Version: unspecifiedFlags: sebastian.zarnekow: helios+
Target Milestone: SR1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ed Willink CLA 2010-07-20 12:46:22 EDT
Given an editor for a multi-package model such as OCLinEcore in which the OCLinEcoreCST package defines a concrete type that refines an abstract type in the BaseCST package, the installation of proxies discovers that the type in the BaseCST package is abstract and so searches for a concrete sub-type. No problem.

But, with the concrete sub-type in another package, LazyLinker.findInstantiableCompatible searches all possible URIs and eventually finds the package from which the editor was derived in the first place.

a) this is very inefficient
b) because of Bug 320417 whereby EMF wraps a CNFE when loading a class-less JST EPackage registration, the search is terminated before the required package is found; editor initialization gives a very obscure message.

b) the loop should catch a WrappedException
a) local packages should be searched first
? should global packages be search at all?

Effectively this means that Xtext and JST are incompatible.
Comment 1 Sebastian Zarnekow CLA 2010-07-30 12:50:41 EDT
Besides the suggestions, we should provide a hook that allows to define the packages that should be searched first.

What are local packages?
Comment 2 Ed Willink CLA 2010-07-30 13:02:33 EDT
Minimal local: the current packages (imported by the editor grammar)

Inherited local: the packages of the transitive closure of the inheritance of the classes in the current packages

Maximal local: the packages of the transitive closure of the references of the classes in the current packages  

I suspect that "Inherited local" is enough for this problem, but there seems no justification going beyond "Maximal local" except when doing a Content Assist/Quick Fix and even then I think there should be a click-through to authorize loading all packages (which is much more costly and less well-behaved than loading all Java classes).
Comment 3 Ed Willink CLA 2010-07-31 09:43:12 EDT
*** Bug 321432 has been marked as a duplicate of this bug. ***
Comment 4 Sebastian Zarnekow CLA 2010-08-02 10:27:43 EDT
Fixed in HEAD. See LazyLinker#globalFindInstantiableCompatible for details.
Comment 5 Karsten Thoms CLA 2017-09-19 15:52:20 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.