Skip to main content
Jump to: navigation, search

JET FAQ What is JMerge?

Revision as of 09:57, 1 August 2007 by (Talk | contribs) (Initial content)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Whay is JMerge?


JMerge is a technology developed by the Eclipse Modeling Framework (EMF) so that code generators that produce Java code can permit user modification of that code, while still permitting the code generator to be re-executed.

Using JMerge creates a contract between Code Generator and the Consumer. The actual contract depends which JMerge rules are used. Here is a description of the contract for the JMerge rules provided by EMF.

  • On code generation execution/re-execution
    1. The Code Generator shall only update Java elements with an intact @generated tag.
    2. The Code Generator may remove Java elements with an intact @generated tag this is no longer specified by the code generator input. The Consumer must be aware that such removal can result in compilation users in the Consumer's code.
  • While editing generated Java code
    1. The Consumer may add new Java elements without worry that the Code Generator will overwrite them. The Consumer must be aware that a subsequent change in the code generator's input may cause the Code Generator to fail to write a Java element with the same signature as the new element. JMerge provides no feedback that such a failure has occured.
    2. The Consumer may modify a generated Java element (and preserve their changes) by removing or defacing the @generated javadoc tag on the element. Defacing is a good practices, is it clearly indicates the Consumer's intent to modify generated code. Common ways of defacing the @generated tag are to change it to '@generated not' or '@!generated'.

See Also

Back to the M2T-JET-FAQ

Back to the top