1

How can a variable of type char be assigned? I am looking for the Xtend equivalent of javas:

char c='?';

In Xtend the compiler reject all quotation marks like ' or " because they produce a String:

var char c='?'; 

^ Error: Incompatible types. Expected char or java.lang.Character but was java.lang.String

Xtext Version is 2.2

Chriss
  • 5,157
  • 7
  • 41
  • 75

2 Answers2

3

Since 2.4 you can write:

val char c = '?'
Sven Efftinge
  • 3,065
  • 17
  • 17
1

Currently you have to use '?'.charAt(0).

Sebastian Zarnekow
  • 6,609
  • 20
  • 23
  • Ohh... nice! I thought you are kidding, but you are a Xtext commiter, so i think the answer is credible. Is there a plan to get this fixed? – Chriss Jun 12 '12 at 10:35
  • 2
    Yes, we will adress this issue in the release after 2.3. I expect that to be available in autumn. – Sebastian Zarnekow Jun 12 '12 at 11:32