I have an xbase-grammar which I infer to Java-code.
In the inferred code, I use my own data types.
I have changed the TypeComputer and -Provider so that a XStringLiteral is computed to type MyString.
This is working without problems.
The DSL code
is inferred to
MyString a = new MyString("abc");
a = new MyString("def");
I would like this to be inferred to:
final MyString a = new MyString("abc");
a.set(new MyString("def"));
So the variable declarations should create a final variable. But still I would like the be able to change the value by using the set-method.
What would be the best way to achieve this?
Would I need to modify the grammar and make my own rules for assignments?
Or is it possible to influence the scoping so that the assignment is pointed to call the set-method?
Thanks for any hint,
Matthias