Generated… not

Using JMerge makes it easy to combine generated code with custom code, preserving any modifications when re-generating. So, for example, you might have this generated code:

  * some generated code which hasn't been modified
  * @generated

public void doSomething() {
   // anything here can get overwritten when the
   // code is regenerated

Which you might modify:

  * some generated code which has been modified
  * @generated NOT: added important bit

public void doSomething() {
   // really important stuff which I don't want overwritten
   // when the code is regenerated

Nice but, having a short memory, I need a way to keep track of all these modified bits of code and luckily the Java task tag feature in Eclipse comes to the rescue with a simple solution. Open ‘Window > Preferences…’ in the main Eclipse menu. Find the ‘Java > Compiler > Task Tags’ page. Press the ‘New…’ button and enter the following details:

  • Tag: “@generated NOT”
  • Priority: Low

Problem solved: the tasks view will list everything you changed!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s