Meta model generation with incremental compiler - fieldenms/tg GitHub Wiki
Meta-model generation with incremental compiler
Abstract
This document provides insights into the process of meta-model generation by the annotation processor when used in incremental compilation environments. The research was done using the incremental compiler in Eclipse IDE. Other incremental compilers may yield results that differ from those described here.
There are 3 types of structural changes to metamodeled entities that are categorized by their cost:
- Low-cost
- Medium-cost
- High-cost
Each of them is described in turn by using the following language:
TheEntity
- entity that was structurally modified and caused the compilationTheMetaModel
- meta-model ofTheEntity
MetaModels
- the meta-models collection class that is generated as an entry point to all meta-modelsLookupInput
- a list of sources that will be fed as input to the lookup algorithm of the incremental compiler in order to find and recompile sources that might be affected by the structural change. The lookup algorithm is described here.
Low-cost changes
Low-cost changes don't cause structural changes to TheMetaModel
, which will be regenerated in the same form as it existed previously.
The compiler will then compile TheMetaModel
and compare the .class
files. Seeing that they are the same, it will simply skip it.
The lookup algorithm will then search only for sources that depend on TheEntity
.
LookupInput = [TheEntity]
Medium-cost changes
Medium-cost changes are a subset of those that cause structural changes to TheMetaModel
, such as modification/addition/removal of a property.
They are defined as a subset, because there are other types of changes in the superset, which are high-cost (described below).
TheMetaModel
will be regenerated in a new form (reflecting the change) and recompiled.
The lookup algorithm will then search sources affected both by TheEntity
and TheMetaModel
.
LookupInput = [TheEntity, TheMetaModel]
High-cost changes
High-cost changes cause structural changes to both TheMetaModel
and MetaModels
.
They are deemed expensive for the fact that they cause MetaModels
to be structurally modified.
This means that the lookup algorithm will search for sources that depend on TheEntity
, TheMetaModel
and MetaModels
.
The latter will cause the most expensive computation since every user of MetaModels
will be recompiled.
LookupInput = [TheEntity, TheMetaModel, MetaModels]
Examples
TheEntity
becomes metamodeled, which causesMetaModels
class to be regenerated with a new field.TheEntity
is no longer metamodeled, which causes deactivation ofTheMetaModel
and regeneration ofMetaModels
with a new structure.