Community
Participate
Working Groups
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.
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().
Fixed in 2.3.0M3.
Move to verified as per bug 206558.