Skip to content

Meta model generation with incremental compiler

01es edited this page Nov 25, 2022 · 3 revisions

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 compilation
  • TheMetaModel - meta-model of TheEntity
  • MetaModels - the meta-models collection class that is generated as an entry point to all meta-models
  • LookupInput - 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

  1. TheEntity becomes metamodeled, which causes MetaModels class to be regenerated with a new field.
  2. TheEntity is no longer metamodeled, which causes deactivation of TheMetaModel and regeneration of MetaModels with a new structure.
Clone this wiki locally