Marty Pitt
Marty Pitt

Reputation: 29280

Xtend build fails, with java containing invalid characters

All of a sudden, the Java classes being generated by Xtend seem to contain invalid syntax.

eg:

public Long getEntityId() {
    return ??field.simpleName??;
}

where previously the syntax was generated correctly:

public Long getEntityId() {
    return entityId;
}

I haven't changed anything related to this class, or the processor - I've simply done an update from my source control.

Upvotes: 1

Views: 229

Answers (1)

Marty Pitt
Marty Pitt

Reputation: 29280

This is caused by the encoding on the Xtend class being set to ASCII, rather than UTF-8 within the IDE.

As a result, the following code (shown in UTF-8 encoding)

body = ['''
    return «field.simpleName»;'''

becomes the following (shown in ASCII encoding

body = ['''
    return ��field.simpleName��;''']

Ensure the project's default is set to UTF-8:

Set eclipse default to UTF-8

Upvotes: 3

Related Questions