Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 163845 - Extensible generator: bugs and Javadoc
Summary: Extensible generator: bugs and Javadoc
Status: VERIFIED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Tools (show other bugs)
Version: 2.2.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dave Steinberg CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 163871
  Show dependency tree
 
Reported: 2006-11-08 15:03 EST by Dave Steinberg CLA
Modified: 2008-01-28 16:47 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Steinberg CLA 2006-11-08 15:03:48 EST
Documentation is required for the extensible generator introduced in bug 75925.

In addition, the following problems have been found:

1. Template paths don't work well. The template path cannot be a a static thing set by the base generator adapter factory. Extensions need to be able to add to the path, ahead of the base framework location, in order for new templates and template overrides to be found.

2. An unneeded .JETEmitters project is created when using static templates in a runtime workbench.

3. When templates need different classpath variables (for instance, when templates introduced by an extension require access to a helper class that isn't used by the base templates), the .JETEmitters classpath changes with each JETEmitter. The classpath is correct for each JETEmitter, so each template compiles and executes correctly, but the project may end up in a state where not all templates can actually compile. This introduces errors that are not meaningful.

4. GeneratorAdapterFactory.Descriptor.DelegatingRegistry.getDescriptors(String) can fail to delegate if a descriptor is added for a package ID and then removed, since the entry in the map will be an empty list, not null.
Comment 1 Dave Steinberg CLA 2006-11-08 16:19:50 EST
The Javadoc and fixes are in CVS.

1. Generator.Options.templatePath is no longer set by GenModelGeneratorAdapterFactory.initialize(). In AbstractGeneratorAdapter, createJETEmitter() and createGIFEmitter() no longer directly access this option. Instead, they call getTemplatePath(), which, if it is null, forms a path using the getUserTemplatePath() and addBaseTemplatePathEntries() template methods. GenBaseGeneratorAdapter overrides both of these methods to provide a default path. Derived adapters can override the latter method to add to the template path ahead of the default base entry.

2. This is fixed in JETEmitter.addVariable() by checking that a method hasn't already been set, which would indicate a static template.

3. This is fixed in JETEmitter.EclipseHelper.initialize() by adding entries to the project's classpath, instead of resetting it every time. I was seeing that projects are created with the project root on the classpath, so I found that such an entry has to be removed, to avoid errors when adding /src to the classpath.

4. Trivial fix in getDescriptors().
Comment 2 Nick Boldt CLA 2006-11-09 20:11:57 EST
Fixed in 2.3.0M3.
Comment 3 Nick Boldt CLA 2008-01-28 16:47:55 EST
Move to verified as per bug 206558.